         }
         if let code = json["code"].asInt32 {
             if let errno = json["errno"].asInt32 {
-                return RemoteError(code: code, reason: FxAccountRemoteError(rawValue: errno),
+                return RemoteError(code: code, errno: errno,
                                    error: json["error"].asString,
                                    message: json["message"].asString,
                                    info: json["info"].asString)

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

    }

    var isUnverified: Bool {
        return errno == FxAccountRemoteError.ATTEMPT_TO_OPERATE_ON_AN_UNVERIFIED_ACCOUNT
    }
}

