-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMatrixCoreError.swift
More file actions
51 lines (47 loc) · 1.69 KB
/
MatrixCoreError.swift
File metadata and controls
51 lines (47 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// File.swift
//
//
// Created by Finn Behrens on 26.03.22.
//
import Foundation
public enum MatrixCoreError: Error {
case actorMissing
case missingData
case creationError
case batchInsertError
case batchDeleteError
case persistentHistoryChangeError
case unexpectedError(error: Error)
case keychainError(OSStatus)
}
extension MatrixCoreError: LocalizedError {
public var errorDescription: String? {
switch self {
case .actorMissing:
return NSLocalizedString("Did not found MatrixCore instance to use for request", comment: "")
case .missingData:
return NSLocalizedString(
"Found and will discard a quake missing a valid code, magnitude, place, or time.",
comment: ""
)
case .creationError:
return NSLocalizedString("Failed to create a new Quake object.", comment: "")
case .batchInsertError:
return NSLocalizedString("Failed to execute a batch insert request.", comment: "")
case .batchDeleteError:
return NSLocalizedString("Failed to execute a batch delete request.", comment: "")
case .persistentHistoryChangeError:
return NSLocalizedString("Failed to execute a persistent history change request.", comment: "")
case let .unexpectedError(error):
return NSLocalizedString("Received unexpected error. \(error.localizedDescription)", comment: "")
case let .keychainError(error):
return NSLocalizedString("Keychain did not succedd. \(error)", comment: "")
}
}
}
extension MatrixCoreError: Identifiable {
public var id: String? {
errorDescription
}
}