summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-09-16 16:12:59 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2020-09-16 18:01:06 +0200
commitff7d7e0edd9fbcafeea3bfb56c8d3a1f136efb56 (patch)
treeb3a7ef2ab041a1c52c46f9c2f58cd86038226aa2 /tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
parent2f088938c6c8c718d0a4ed639c18868257e354a1 (diff)
tunnel: document more public API from backend package
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/android/backend/BackendException.java')
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/BackendException.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java b/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
index 5552b3ee..b64ebb47 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java
@@ -7,24 +7,47 @@ package com.wireguard.android.backend;
import com.wireguard.util.NonNullForAll;
+/**
+ * A subclass of {@link Exception} that encapsulates the reasons for a failure originating in
+ * implementations of {@link Backend}.
+ */
@NonNullForAll
public final class BackendException extends Exception {
private final Object[] format;
private final Reason reason;
+ /**
+ * Public constructor for BackendException.
+ *
+ * @param reason The {@link Reason} which caused this exception to be thrown
+ * @param format Format string values used when converting exceptions to user-facing strings.
+ */
public BackendException(final Reason reason, final Object... format) {
this.reason = reason;
this.format = format;
}
+ /**
+ * Get the format string values associated with the instance.
+ *
+ * @return Array of {@link Object} for string formatting purposes
+ */
public Object[] getFormat() {
return format;
}
+ /**
+ * Get the reason for this exception.
+ *
+ * @return Associated {@link Reason} for this exception.
+ */
public Reason getReason() {
return reason;
}
+ /**
+ * Enum class containing all known reasons for why a {@link BackendException} might be thrown.
+ */
public enum Reason {
UNKNOWN_KERNEL_MODULE_NAME,
WG_QUICK_CONFIG_ERROR_CODE,