 
 public struct RemoteError {
     let code: Int32
-    let reason: FxAccountRemoteError?
+    let errno: Int32
     let error: String?
     let message: String?
     let info: String?
 
     var isUpgradeRequired: Bool {
-        guard let reason = self.reason else {
-            return false
-        }
-        let mandantoryUpgradeErrors: [FxAccountRemoteError] = [.endpointNoLongerSupported, .incorrectLoginMethodForThisAccount, .incorrectKeyRetrievalMethodForThisAccount, .incorrectAPIVersionForThisAccount]
-        return mandantoryUpgradeErrors.contains(reason)
+        return errno == FxAccountRemoteError.ENDPOINT_IS_NO_LONGER_SUPPORTED
+            || errno == FxAccountRemoteError.INCORRECT_LOGIN_METHOD_FOR_THIS_ACCOUNT
+            || errno == FxAccountRemoteError.INCORRECT_KEY_RETRIEVAL_METHOD_FOR_THIS_ACCOUNT
+            || errno == FxAccountRemoteError.INCORRECT_API_VERSION_FOR_THIS_ACCOUNT
     }
 
     var isInvalidAuthentication: Bool {

    }
}

public enum FxAccountRemoteError: Int32 {
    case attemptToOperateOnAnUnverifiedAccount = 104
    case invalidAuthenticationToken = 110
    case endpointNoLongerSupported = 116
    case incorrectLoginMethodForThisAccount = 117
    case incorrectKeyRetrievalMethodForThisAccount = 118
    case incorrectAPIVersionForThisAccount = 119
    case unknownDevice = 123
    case sessionAlreadyRegisteredByAnotherDevice = 124
    case unknownError = 999
}

public struct FxAKeysResponse {

    
    public func handleError(account: FirefoxAccount, deferred: Deferred<Maybe<FxADeviceRegistrationResponse>>, error: RemoteError, sessionToken: NSData)  {
        if error.code == 400 {
            if error.errno == FxAccountRemoteError.UNKNOWN_DEVICE {
                recoverFromUnknownDevice(account)
                deferred.fill(Maybe(failure: FxAClientError.Remote(error)))
            } else if error.errno == FxAccountRemoteError.DEVICE_SESSION_CONFLICT {
                recoverFromDeviceSessionConflict(deferred, error: error, sessionToken: sessionToken)
            }
        } else if error.code == 401 && error.errno == FxAccountRemoteError.INVALID_AUTHENTICATION_TOKEN {
            handleTokenError(account, deferred: deferred, error: error)
        } else {
            logErrorAndResetDeviceRegistrationVersion(account, error: error)
