summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/psmb4j/util/error
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/keuin/psmb4j/util/error')
-rw-r--r--src/main/java/com/keuin/psmb4j/util/error/SocketClosedException.java15
-rw-r--r--src/main/java/com/keuin/psmb4j/util/error/StringLengthExceededException.java9
2 files changed, 24 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/psmb4j/util/error/SocketClosedException.java b/src/main/java/com/keuin/psmb4j/util/error/SocketClosedException.java
new file mode 100644
index 0000000..e7c9b2d
--- /dev/null
+++ b/src/main/java/com/keuin/psmb4j/util/error/SocketClosedException.java
@@ -0,0 +1,15 @@
+package com.keuin.psmb4j.util.error;
+
+import java.io.IOException;
+
+/**
+ * The socket closed before enough bytes have been read out.
+ */
+public class SocketClosedException extends IOException {
+ public SocketClosedException() {
+ }
+
+ public SocketClosedException(long expected, long actual) {
+ super(String.format("expected %d bytes, EOF after reading %d bytes", expected, actual));
+ }
+}
diff --git a/src/main/java/com/keuin/psmb4j/util/error/StringLengthExceededException.java b/src/main/java/com/keuin/psmb4j/util/error/StringLengthExceededException.java
new file mode 100644
index 0000000..afb08b6
--- /dev/null
+++ b/src/main/java/com/keuin/psmb4j/util/error/StringLengthExceededException.java
@@ -0,0 +1,9 @@
+package com.keuin.psmb4j.util.error;
+
+import java.io.IOException;
+
+public class StringLengthExceededException extends IOException {
+ public StringLengthExceededException(long length) {
+ super(String.format("String is too long (%d Bytes)", length));
+ }
+}