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 
19   // Because this enum is exported to Objective-C,
20   // the usual "\(UpdatesErrorCode.NoUpdatesAvailable)"
21   // string representation will not work as expected,
22   // so we add this representation here
23   public var asString: String {
24     switch self {
25     case .none:
26       return "None"
27     case .noUpdatesAvailable:
28       return "NoUpdatesAvailable"
29     case .updateAssetsNotAvailable:
30       return "UpdateAssetsNotAvailable"
31     case .updateServerUnreachable:
32       return "UpdateServerUnreachable"
33     case .updateHasInvalidSignature:
34       return "UpdateHasInvalidSignature"
35     case .updateFailedToLoad:
36       return "UpdateFailedToLoad"
37     case .assetsFailedToLoad:
38       return "AssetsFailedToLoad"
39     case .jsRuntimeError:
40       return "JSRuntimeError"
41     }
42   }
43 }
44