mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.7 KiB
Swift
43 lines
1.7 KiB
Swift
1 year ago
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||
|
//
|
||
|
// stringlint:disable
|
||
|
|
||
|
import Foundation
|
||
|
import SessionUtil
|
||
|
|
||
11 months ago
|
public enum LibSessionError: Error, CustomStringConvertible {
|
||
1 year ago
|
case unableToCreateConfigObject
|
||
11 months ago
|
case invalidConfigObject
|
||
|
case invalidDataProvided
|
||
1 year ago
|
case userDoesNotExist
|
||
|
case getOrConstructFailedUnexpectedly
|
||
|
case processingLoopLimitReached
|
||
11 months ago
|
case failedToRetrieveConfigData
|
||
1 year ago
|
|
||
|
case libSessionError(String)
|
||
|
|
||
|
public init(_ cError: [CChar]) {
|
||
|
self = LibSessionError.libSessionError(String(cString: cError))
|
||
|
}
|
||
|
|
||
|
public init(_ errorString: String) {
|
||
|
switch errorString {
|
||
|
default: self = LibSessionError.libSessionError(errorString)
|
||
|
}
|
||
|
}
|
||
|
|
||
11 months ago
|
public var description: String {
|
||
1 year ago
|
switch self {
|
||
11 months ago
|
case .unableToCreateConfigObject: return "Unable to create config object (LibSessionError.unableToCreateConfigObject)."
|
||
|
case .invalidConfigObject: return "Invalid config object (LibSessionError.invalidConfigObject)."
|
||
|
case .invalidDataProvided: return "Invalid data provided (LibSessionError.invalidDataProvided)."
|
||
|
case .userDoesNotExist: return "User does not exist (LibSessionError.userDoesNotExist)."
|
||
|
case .getOrConstructFailedUnexpectedly: return "'getOrConstruct' failed unexpectedly (LibSessionError.getOrConstructFailedUnexpectedly)."
|
||
|
case .processingLoopLimitReached: return "Processing loop limit reached (LibSessionError.processingLoopLimitReached)."
|
||
|
case .failedToRetrieveConfigData: return "Failed to retrieve config data."
|
||
1 year ago
|
|
||
11 months ago
|
case .libSessionError(let error): return "\(error)\(period: error)"
|
||
1 year ago
|
}
|
||
|
}
|
||
|
}
|