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