summaryrefslogtreecommitdiff
path: root/lib/src/main/kotlin/except
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/main/kotlin/except')
-rw-r--r--lib/src/main/kotlin/except/FailedAuthenticationException.kt8
-rw-r--r--lib/src/main/kotlin/except/InvalidMessageException.kt8
-rw-r--r--lib/src/main/kotlin/except/MsizeValueTooBigException.kt10
-rw-r--r--lib/src/main/kotlin/except/RErrorException.kt8
-rw-r--r--lib/src/main/kotlin/except/UnaccessibleFileException.kt11
-rw-r--r--lib/src/main/kotlin/except/UnknownVersionException.kt9
-rw-r--r--lib/src/main/kotlin/except/UnresolvableHostException.kt8
7 files changed, 62 insertions, 0 deletions
diff --git a/lib/src/main/kotlin/except/FailedAuthenticationException.kt b/lib/src/main/kotlin/except/FailedAuthenticationException.kt
new file mode 100644
index 0000000..94935c3
--- /dev/null
+++ b/lib/src/main/kotlin/except/FailedAuthenticationException.kt
@@ -0,0 +1,8 @@
+package except
+
+/**
+ * The authentication with the remote part failed.
+ *
+ * @param reason A human-readable reason for which the authentication failed.
+ */
+class FailedAuthenticationException(val reason: String) : Exception("Authentication with remote host failed: $reason") \ No newline at end of file
diff --git a/lib/src/main/kotlin/except/InvalidMessageException.kt b/lib/src/main/kotlin/except/InvalidMessageException.kt
new file mode 100644
index 0000000..02a3cc4
--- /dev/null
+++ b/lib/src/main/kotlin/except/InvalidMessageException.kt
@@ -0,0 +1,8 @@
+package except
+
+/**
+ * The packet that is currently being read is not valid.
+ *
+ * @param reason The reason for which the packet is invalid.
+ */
+class InvalidMessageException(val reason: String) : Exception("Invalid packet: $reason") \ No newline at end of file
diff --git a/lib/src/main/kotlin/except/MsizeValueTooBigException.kt b/lib/src/main/kotlin/except/MsizeValueTooBigException.kt
new file mode 100644
index 0000000..f1f6da1
--- /dev/null
+++ b/lib/src/main/kotlin/except/MsizeValueTooBigException.kt
@@ -0,0 +1,10 @@
+package except
+
+/**
+ * This exception is thrown when the `msize` value sent by the server is bigger than that sent by the client during the
+ * version transaction.
+ *
+ * @param maxClientValue The value requested by the client.
+ * @param receivedValue The value sent by the server.
+ */
+class MsizeValueTooBigException(val maxClientValue: UInt, val receivedValue: UInt) : Exception("Msize value too big: $receivedValue > $maxClientValue") \ No newline at end of file
diff --git a/lib/src/main/kotlin/except/RErrorException.kt b/lib/src/main/kotlin/except/RErrorException.kt
new file mode 100644
index 0000000..c15cbc2
--- /dev/null
+++ b/lib/src/main/kotlin/except/RErrorException.kt
@@ -0,0 +1,8 @@
+package except
+
+/**
+ * This exception represents an error sent by the remote server as an R-error message.
+ *
+ * @param message The message sent by the server.
+ */
+class RErrorException(val rErrorMessage: String?) : Exception("R-error message received: $rErrorMessage") \ No newline at end of file
diff --git a/lib/src/main/kotlin/except/UnaccessibleFileException.kt b/lib/src/main/kotlin/except/UnaccessibleFileException.kt
new file mode 100644
index 0000000..07d5d13
--- /dev/null
+++ b/lib/src/main/kotlin/except/UnaccessibleFileException.kt
@@ -0,0 +1,11 @@
+package except
+
+/**
+ * This exception is thrown when the file that the client is trying to open (or walk through, in case of a directory)
+ * cannot be accessed.
+ *
+ * @param path The path, as a list of path elements, that the client tried to access, up to and including the first
+ * element that cannot be accessed (e.g. if the path the user wants to access is `["usr", "foo", "bar", "zib"]` but
+ * `bar` does not exist, then [path] must be `["usr", "foo", "bar"]`).
+ */
+class UnaccessibleFileException(val path: List<String>) : Exception("Could not walk to file ${path.joinToString(separator = "/")}.") \ No newline at end of file
diff --git a/lib/src/main/kotlin/except/UnknownVersionException.kt b/lib/src/main/kotlin/except/UnknownVersionException.kt
new file mode 100644
index 0000000..5023bc5
--- /dev/null
+++ b/lib/src/main/kotlin/except/UnknownVersionException.kt
@@ -0,0 +1,9 @@
+package except
+
+/**
+ * This exception is thrown when the remote server sent either an "unknown" version back during the version negotiation
+ * procedure or a version unknown to this client implementation.
+ *
+ * @param version The version sent by the server.
+ */
+class UnknownVersionException(val version: String) : Exception("Unknown version: $version") \ No newline at end of file
diff --git a/lib/src/main/kotlin/except/UnresolvableHostException.kt b/lib/src/main/kotlin/except/UnresolvableHostException.kt
new file mode 100644
index 0000000..19dd3b6
--- /dev/null
+++ b/lib/src/main/kotlin/except/UnresolvableHostException.kt
@@ -0,0 +1,8 @@
+package except
+
+/**
+ * The specified domain, which identifies the host's address, could not be resolved.
+ *
+ * @param address The unresolvable address.
+ */
+class UnresolvableHostException(val address: String) : Exception("Hostname $address unresolvable.") \ No newline at end of file