@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
51 lines (49 loc) • 3.57 kB
JavaScript
"use strict";
/**
* Copyright © 2024 Nevis Security AG. All rights reserved.
*/
import { PendingOutOfBandOperationsClockSkewTooBig } from './PendingOutOfBandOperationsClockSkewTooBig';
import { PendingOutOfBandOperationsDeviceProtectionError } from './PendingOutOfBandOperationsDeviceProtectionError';
import { PendingOutOfBandOperationsNetworkError } from './PendingOutOfBandOperationsNetworkError';
import { PendingOutOfBandOperationsNoDeviceLockError } from './PendingOutOfBandOperationsNoDeviceLockError';
import { PendingOutOfBandOperationsOperationNotSupportedByBackendError } from './PendingOutOfBandOperationsOperationNotSupportedByBackendError';
import { PendingOutOfBandOperationsUnknownError } from './PendingOutOfBandOperationsUnknownError';
import { ErrorConverter } from '../../ErrorConverter';
var PendingOutOfBandOperationsErrorType = /*#__PURE__*/function (PendingOutOfBandOperationsErrorType) {
PendingOutOfBandOperationsErrorType[PendingOutOfBandOperationsErrorType["ClockSkewTooBig"] = 0] = "ClockSkewTooBig";
PendingOutOfBandOperationsErrorType[PendingOutOfBandOperationsErrorType["DeviceProtectionError"] = 1] = "DeviceProtectionError";
PendingOutOfBandOperationsErrorType[PendingOutOfBandOperationsErrorType["NetworkError"] = 2] = "NetworkError";
PendingOutOfBandOperationsErrorType[PendingOutOfBandOperationsErrorType["NoDeviceLockError"] = 3] = "NoDeviceLockError";
PendingOutOfBandOperationsErrorType[PendingOutOfBandOperationsErrorType["OperationNotSupportedByBackend"] = 4] = "OperationNotSupportedByBackend";
PendingOutOfBandOperationsErrorType[PendingOutOfBandOperationsErrorType["Unknown"] = 5] = "Unknown";
return PendingOutOfBandOperationsErrorType;
}(PendingOutOfBandOperationsErrorType || {});
export class PendingOutOfBandOperationsErrorConverter extends ErrorConverter {
convert() {
const subType = PendingOutOfBandOperationsErrorType[this.error.type];
switch (subType) {
case PendingOutOfBandOperationsErrorType.ClockSkewTooBig:
if (this.error.server) {
return new PendingOutOfBandOperationsClockSkewTooBig(this.error.server, this.error.description, this.error.cause);
}
return new PendingOutOfBandOperationsUnknownError(this.error.description, this.error.cause);
case PendingOutOfBandOperationsErrorType.DeviceProtectionError:
return new PendingOutOfBandOperationsDeviceProtectionError(this.error.description, this.error.cause);
case PendingOutOfBandOperationsErrorType.NetworkError:
if (this.error.server) {
return new PendingOutOfBandOperationsNetworkError(this.error.server, this.error.description, this.error.cause);
}
return new PendingOutOfBandOperationsUnknownError(this.error.description, this.error.cause);
case PendingOutOfBandOperationsErrorType.NoDeviceLockError:
return new PendingOutOfBandOperationsNoDeviceLockError(this.error.description, this.error.cause);
case PendingOutOfBandOperationsErrorType.OperationNotSupportedByBackend:
if (this.error.server) {
return new PendingOutOfBandOperationsOperationNotSupportedByBackendError(this.error.server, this.error.description, this.error.cause);
}
return new PendingOutOfBandOperationsUnknownError(this.error.description, this.error.cause);
case PendingOutOfBandOperationsErrorType.Unknown:
return new PendingOutOfBandOperationsUnknownError(this.error.description, this.error.cause, this.error.server);
}
}
}
//# sourceMappingURL=PendingOutOfBandOperationsErrorConverter.js.map