summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadVPN/MullvadAPI.swift29
1 files changed, 29 insertions, 0 deletions
diff --git a/ios/MullvadVPN/MullvadAPI.swift b/ios/MullvadVPN/MullvadAPI.swift
index be87728b7f..055b55e078 100644
--- a/ios/MullvadVPN/MullvadAPI.swift
+++ b/ios/MullvadVPN/MullvadAPI.swift
@@ -204,3 +204,32 @@ class MullvadAPI {
return decoder
}
}
+
+
+extension JsonRpcResponseError: LocalizedError
+ where
+ ResponseCode == MullvadAPI.ResponseCode
+{
+ var errorDescription: String? {
+ switch code {
+ case .accountDoesNotExist:
+ return NSLocalizedString("Invalid account", comment: "")
+
+ case .tooManyWireguardKeys:
+ return NSLocalizedString("Too many public WireGuard keys", comment: "")
+
+ case .other:
+ return nil
+ }
+ }
+
+ var recoverySuggestion: String? {
+ switch code {
+ case .tooManyWireguardKeys:
+ return NSLocalizedString("Remove unused WireGuard keys", comment: "")
+
+ default:
+ return nil
+ }
+ }
+}