1 // Copyright 2022-present 650 Industries. All rights reserved.
2 
3 import Foundation
4 
5 /**
6  Error codes for expo-updates logs
7  */
8 internal enum UpdatesErrorCode: Int {
9   case none = 0
10   case noUpdatesAvailable = 1
11   case updateAssetsNotAvailable = 2
12   case updateServerUnreachable = 3
13   case updateHasInvalidSignature = 4
14   case updateFailedToLoad = 5
15   case assetsFailedToLoad = 6
16   case jsRuntimeError = 7
17   case unknown = 8
18   case updateCodeSigningError = 9
19 
20   // Because this enum is exported to Objective-C,
21   // the usual "\(UpdatesErrorCode.NoUpdatesAvailable)"
22   // string representation will not work as expected,
23   // so we add this representation here
24   var asString: String {
25     switch self {
26     case .none:
27       return "None"
28     case .noUpdatesAvailable:
29       return "NoUpdatesAvailable"
30     case .updateAssetsNotAvailable:
31       return "UpdateAssetsNotAvailable"
32     case .updateServerUnreachable:
33       return "UpdateServerUnreachable"
34     case .updateHasInvalidSignature:
35       return "UpdateHasInvalidSignature"
36     case .updateCodeSigningError:
37       return "UpdateCodeSigningError"
38     case .updateFailedToLoad:
39       return "UpdateFailedToLoad"
40     case .assetsFailedToLoad:
41       return "AssetsFailedToLoad"
42     case .jsRuntimeError:
43       return "JSRuntimeError"
44     case .unknown:
45       return "Unknown"
46     }
47   }
48 }
49