@ -5,7 +5,7 @@
import Foundation
import SessionUtilitiesKit
public enum SnodeAPIError : Localized Error {
public enum SnodeAPIError : Error, CustomStringConvertible {
case clockOutOfSync
case snodePoolUpdatingFailed
case inconsistentSnodePools
@ -34,35 +34,35 @@ public enum SnodeAPIError: LocalizedError {
case unreachable
case unassociatedPubkey
public var errorDescription: String ? {
public var description: String {
switch self {
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 ."
case . responseFailedValidation : return " Response failed validation ."
case . rateLimited : return " Rate limited ."
case . missingSnodeVersion : return " Missing Service Node version ."
case . unsupportedSnodeVersion ( let version ) : return " Unsupported Service Node version: \( version ) ."
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 (SnodeAPIError.clockOutOfSync) ."
case . snodePoolUpdatingFailed : return " Failed to update the Service Node pool (SnodeAPIError.snodePoolUpdatingFailed) ."
case . inconsistentSnodePools : return " Received inconsistent Service Node pool information from the Service Node network (SnodeAPIError.inconsistentSnodePools) ."
case . noKeyPair : return " Missing user key pair (SnodeAPIError.noKeyPair) ."
case . signingFailed : return " Couldn't sign message (SnodeAPIError.signingFailed) ."
case . signatureVerificationFailed : return " Failed to verify the signature (SnodeAPIError.signatureVerificationFailed) ."
case . invalidIP : return " Invalid IP (SnodeAPIError.invalidIP) ."
case . responseFailedValidation : return " Response failed validation (SnodeAPIError.responseFailedValidation) ."
case . rateLimited : return " Rate limited (SnodeAPIError.rateLimited) ."
case . missingSnodeVersion : return " Missing Service Node version (SnodeAPIError.missingSnodeVersion) ."
case . unsupportedSnodeVersion ( let version ) : return " Unsupported Service Node version: \( version ) (SnodeAPIError.unsupportedSnodeVersion) ."
// O n i o n R e q u e s t E r r o r s
case . emptySnodePool : return " Service Node pool is empty ."
case . insufficientSnodes : return " Couldn't find enough Service Nodes to build a path ."
case . ranOutOfRandomSnodes : return " Ran out of random snodes to send the request through ."
case . emptySnodePool : return " Service Node pool is empty (SnodeAPIError.emptySnodePool) ."
case . insufficientSnodes : return " Couldn't find enough Service Nodes to build a path (SnodeAPIError.insufficientSnodes) ."
case . ranOutOfRandomSnodes : return " Ran out of random snodes to send the request through (SnodeAPIError.ranOutOfRandomSnodes) ."
// O N S
case . decryptionFailed : return " Couldn't decrypt ONS name ."
case . hashingFailed : return " Couldn't compute ONS name hash ."
case . validationFailed : return " ONS name validation failed ."
case . decryptionFailed : return " Couldn't decrypt ONS name (SnodeAPIError.decryptionFailed) ."
case . hashingFailed : return " Couldn't compute ONS name hash (SnodeAPIError.hashingFailed) ."
case . validationFailed : return " ONS name validation failed (SnodeAPIError.validationFailed) ."
// Q u i c
case . invalidPayload : return " Invalid payload ."
case . missingSecretKey : return " Missing secret key ."
case . unreachable : return " The service node is unreachable ."
case . unassociatedPubkey : return " The service node is no longer associated with the public key ."
case . invalidPayload : return " Invalid payload (SnodeAPIError.invalidPayload) ."
case . missingSecretKey : return " Missing secret key (SnodeAPIError.missingSecretKey) ."
case . unreachable : return " The service node is unreachable (SnodeAPIError.unreachable) ."
case . unassociatedPubkey : return " The service node is no longer associated with the public key (SnodeAPIError.unassociatedPubkey) ."
}
}
}