2022-06-08 06:29:51 +02:00
|
|
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
2023-09-25 10:32:56 +02:00
|
|
|
//
|
|
|
|
// stringlint:disable
|
2022-06-08 06:29:51 +02:00
|
|
|
|
|
|
|
import Foundation
|
2022-06-09 10:37:44 +02:00
|
|
|
|
|
|
|
public enum SnodeAPIError: LocalizedError {
|
|
|
|
case generic
|
|
|
|
case clockOutOfSync
|
|
|
|
case snodePoolUpdatingFailed
|
|
|
|
case inconsistentSnodePools
|
|
|
|
case noKeyPair
|
|
|
|
case signingFailed
|
|
|
|
case signatureVerificationFailed
|
|
|
|
case invalidIP
|
2022-11-27 22:32:32 +01:00
|
|
|
case emptySnodePool
|
2023-02-20 02:56:48 +01:00
|
|
|
case responseFailedValidation
|
2022-06-09 10:37:44 +02:00
|
|
|
|
|
|
|
// ONS
|
|
|
|
case decryptionFailed
|
|
|
|
case hashingFailed
|
|
|
|
case validationFailed
|
|
|
|
|
|
|
|
public var errorDescription: String? {
|
|
|
|
switch self {
|
|
|
|
case .generic: return "An error occurred."
|
|
|
|
case .clockOutOfSync: return "Your clock is out of sync with the Service Node network. Please check that your device's clock is set to automatic time."
|
|
|
|
case .snodePoolUpdatingFailed: return "Failed to update the Service Node pool."
|
|
|
|
case .inconsistentSnodePools: return "Received inconsistent Service Node pool information from the Service Node network."
|
|
|
|
case .noKeyPair: return "Missing user key pair."
|
|
|
|
case .signingFailed: return "Couldn't sign message."
|
|
|
|
case .signatureVerificationFailed: return "Failed to verify the signature."
|
|
|
|
case .invalidIP: return "Invalid IP."
|
2022-11-27 22:32:32 +01:00
|
|
|
case .emptySnodePool: return "Service Node pool is empty."
|
2023-02-20 02:56:48 +01:00
|
|
|
case .responseFailedValidation: return "Response failed validation."
|
2022-06-09 10:37:44 +02:00
|
|
|
|
|
|
|
// ONS
|
|
|
|
case .decryptionFailed: return "Couldn't decrypt ONS name."
|
|
|
|
case .hashingFailed: return "Couldn't compute ONS name hash."
|
|
|
|
case .validationFailed: return "ONS name validation failed."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|