1 // Copyright 2022-present 650 Industries. All rights reserved.
2 
3 import Foundation
4 
5 /**
6  Error codes for expo-updates logs
7  */
8 @objc(EXUpdatesErrorCode)
9 public enum UpdatesErrorCode: Int {
10   case none = 0
11   case noUpdatesAvailable = 1
12   case updateAssetsNotAvailable = 2
13   case updateServerUnreachable = 3
14   case updateHasInvalidSignature = 4
15   case updateFailedToLoad = 5
16   case assetsFailedToLoad = 6
17   case jsRuntimeError = 7
18   case unknown = 8
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   public 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 .updateFailedToLoad:
37       return "UpdateFailedToLoad"
38     case .assetsFailedToLoad:
39       return "AssetsFailedToLoad"
40     case .jsRuntimeError:
41       return "JSRuntimeError"
42     case .unknown:
43       return "Unknown"
44     }
45   }
46 }
47