diff options
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.java | 28 |
1 files changed, 26 insertions, 2 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..94f7b098 100644 --- a/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java +++ b/tunnel/src/main/java/com/wireguard/android/backend/BackendException.java @@ -1,5 +1,5 @@ /* - * Copyright © 2020 WireGuard LLC. All Rights Reserved. + * Copyright © 2017-2025 WireGuard LLC. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ @@ -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, @@ -32,6 +55,7 @@ public final class BackendException extends Exception { VPN_NOT_AUTHORIZED, UNABLE_TO_START_VPN, TUN_CREATION_ERROR, - GO_ACTIVATION_ERROR_CODE + GO_ACTIVATION_ERROR_CODE, + DNS_RESOLUTION_FAILURE, } } |