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