@ledgerhq/errors
Advanced tools
Comparing version 6.12.6 to 6.12.7-next.0
# @ledgerhq/errors | ||
## 6.12.7-next.0 | ||
### Patch Changes | ||
- [#3631](https://github.com/LedgerHQ/ledger-live/pull/3631) [`9adc1862dd`](https://github.com/LedgerHQ/ledger-live/commit/9adc1862dda605a722d19f3b6895bd324834c914) Thanks [@scnale](https://github.com/scnale)! - Adds message to TransportStatusErrors displayed in node.js | ||
## 6.12.6 | ||
@@ -4,0 +10,0 @@ |
@@ -16,3 +16,3 @@ import { deserializeError, serializeError } from "./helpers"; | ||
{ name: "foo", stack: "" }, | ||
].forEach((value) => { | ||
].forEach(value => { | ||
it("should never crashes whatever the value is " + JSON.stringify(value), () => { | ||
@@ -37,3 +37,3 @@ expect(() => deserializeError(value)).not.toThrow(); | ||
{ name: "foo", stack: "" }, | ||
].forEach((value) => { | ||
].forEach(value => { | ||
it("should never crashes whatever the value is " + JSON.stringify(value), () => { | ||
@@ -40,0 +40,0 @@ expect(() => serializeError(value)).not.toThrow(); |
@@ -26,6 +26,3 @@ /* eslint-disable no-continue */ | ||
} | ||
if (options && | ||
isObject(options) && | ||
"cause" in options && | ||
!("cause" in this)) { | ||
if (options && isObject(options) && "cause" in options && !("cause" in this)) { | ||
// .cause was specified but the superconstructor | ||
@@ -32,0 +29,0 @@ // did not create an instance property. |
import { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer, LedgerErrorConstructor } from "./helpers"; | ||
export { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer, }; | ||
export { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer }; | ||
export declare const AccountNameRequiredError: LedgerErrorConstructor<{ | ||
@@ -4,0 +4,0 @@ [key: string]: unknown; |
import { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer, } from "./helpers"; | ||
export { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer, }; | ||
export { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer }; | ||
export const AccountNameRequiredError = createCustomErrorClass("AccountNameRequired"); | ||
@@ -149,7 +149,7 @@ export const AccountNotSupported = createCustomErrorClass("AccountNotSupported"); | ||
this.message = message; | ||
this.stack = new Error().stack; | ||
this.stack = new Error(message).stack; | ||
this.id = id; | ||
} | ||
} | ||
addCustomErrorDeserializer("TransportError", (e) => new TransportError(e.message, e.id)); | ||
addCustomErrorDeserializer("TransportError", e => new TransportError(e.message, e.id)); | ||
export const StatusCodes = { | ||
@@ -223,4 +223,3 @@ ACCESS_CONDITION_NOT_FULFILLED: 0x9804, | ||
export function TransportStatusError(statusCode) { | ||
const statusText = Object.keys(StatusCodes).find((k) => StatusCodes[k] === statusCode) || | ||
"UNKNOWN_ERROR"; | ||
const statusText = Object.keys(StatusCodes).find(k => StatusCodes[k] === statusCode) || "UNKNOWN_ERROR"; | ||
const smsg = getAltStatusMessage(statusCode) || statusText; | ||
@@ -235,3 +234,3 @@ const statusCodeStr = statusCode.toString(16); | ||
this.message = message; | ||
this.stack = new Error().stack; | ||
this.stack = new Error(message).stack; | ||
this.statusCode = statusCode; | ||
@@ -241,3 +240,3 @@ this.statusText = statusText; | ||
TransportStatusError.prototype = new Error(); | ||
addCustomErrorDeserializer("TransportStatusError", (e) => new TransportStatusError(e.statusCode)); | ||
addCustomErrorDeserializer("TransportStatusError", e => new TransportStatusError(e.statusCode)); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { AmountRequired, CurrencyNotSupported } from "./index"; | ||
import { AmountRequired, CurrencyNotSupported, TransportStatusError, StatusCodes } from "./index"; | ||
function functionA() { | ||
@@ -70,3 +70,7 @@ throw new AmountRequired(); | ||
}); | ||
test("transport status error contains message", () => { | ||
const error = new TransportStatusError(StatusCodes.UNKNOWN_APDU); | ||
expect(error.stack).toContain("Ledger device: UNKNOWN_APDU (0x6d02)"); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
@@ -18,3 +18,3 @@ "use strict"; | ||
{ name: "foo", stack: "" }, | ||
].forEach((value) => { | ||
].forEach(value => { | ||
it("should never crashes whatever the value is " + JSON.stringify(value), () => { | ||
@@ -39,3 +39,3 @@ expect(() => (0, helpers_1.deserializeError)(value)).not.toThrow(); | ||
{ name: "foo", stack: "" }, | ||
].forEach((value) => { | ||
].forEach(value => { | ||
it("should never crashes whatever the value is " + JSON.stringify(value), () => { | ||
@@ -42,0 +42,0 @@ expect(() => (0, helpers_1.serializeError)(value)).not.toThrow(); |
@@ -30,6 +30,3 @@ "use strict"; | ||
} | ||
if (options && | ||
isObject(options) && | ||
"cause" in options && | ||
!("cause" in this)) { | ||
if (options && isObject(options) && "cause" in options && !("cause" in this)) { | ||
// .cause was specified but the superconstructor | ||
@@ -36,0 +33,0 @@ // did not create an instance property. |
import { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer, LedgerErrorConstructor } from "./helpers"; | ||
export { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer, }; | ||
export { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer }; | ||
export declare const AccountNameRequiredError: LedgerErrorConstructor<{ | ||
@@ -4,0 +4,0 @@ [key: string]: unknown; |
@@ -158,3 +158,3 @@ "use strict"; | ||
this.message = message; | ||
this.stack = new Error().stack; | ||
this.stack = new Error(message).stack; | ||
this.id = id; | ||
@@ -164,3 +164,3 @@ } | ||
exports.TransportError = TransportError; | ||
(0, helpers_1.addCustomErrorDeserializer)("TransportError", (e) => new TransportError(e.message, e.id)); | ||
(0, helpers_1.addCustomErrorDeserializer)("TransportError", e => new TransportError(e.message, e.id)); | ||
exports.StatusCodes = { | ||
@@ -235,4 +235,3 @@ ACCESS_CONDITION_NOT_FULFILLED: 0x9804, | ||
function TransportStatusError(statusCode) { | ||
const statusText = Object.keys(exports.StatusCodes).find((k) => exports.StatusCodes[k] === statusCode) || | ||
"UNKNOWN_ERROR"; | ||
const statusText = Object.keys(exports.StatusCodes).find(k => exports.StatusCodes[k] === statusCode) || "UNKNOWN_ERROR"; | ||
const smsg = getAltStatusMessage(statusCode) || statusText; | ||
@@ -247,3 +246,3 @@ const statusCodeStr = statusCode.toString(16); | ||
this.message = message; | ||
this.stack = new Error().stack; | ||
this.stack = new Error(message).stack; | ||
this.statusCode = statusCode; | ||
@@ -254,3 +253,3 @@ this.statusText = statusText; | ||
TransportStatusError.prototype = new Error(); | ||
(0, helpers_1.addCustomErrorDeserializer)("TransportStatusError", (e) => new TransportStatusError(e.statusCode)); | ||
(0, helpers_1.addCustomErrorDeserializer)("TransportStatusError", e => new TransportStatusError(e.statusCode)); | ||
//# sourceMappingURL=index.js.map |
@@ -72,3 +72,7 @@ "use strict"; | ||
}); | ||
test("transport status error contains message", () => { | ||
const error = new index_1.TransportStatusError(index_1.StatusCodes.UNKNOWN_APDU); | ||
expect(error.stack).toContain("Ledger device: UNKNOWN_APDU (0x6d02)"); | ||
}); | ||
}); | ||
//# sourceMappingURL=index.test.js.map |
{ | ||
"name": "@ledgerhq/errors", | ||
"version": "6.12.6", | ||
"version": "6.12.7-next.0", | ||
"description": "Ledger common errors", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts", | ||
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx", | ||
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache", | ||
"lint:fix": "pnpm lint --fix", | ||
@@ -43,0 +43,0 @@ "test": "jest" |
@@ -17,9 +17,6 @@ import { deserializeError, serializeError } from "./helpers"; | ||
{ name: "foo", stack: "" }, | ||
].forEach((value) => { | ||
it( | ||
"should never crashes whatever the value is " + JSON.stringify(value), | ||
() => { | ||
expect(() => deserializeError(value)).not.toThrow(); | ||
} | ||
); | ||
].forEach(value => { | ||
it("should never crashes whatever the value is " + JSON.stringify(value), () => { | ||
expect(() => deserializeError(value)).not.toThrow(); | ||
}); | ||
}); | ||
@@ -42,10 +39,7 @@ }); | ||
{ name: "foo", stack: "" }, | ||
].forEach((value) => { | ||
it( | ||
"should never crashes whatever the value is " + JSON.stringify(value), | ||
() => { | ||
expect(() => serializeError(value as any)).not.toThrow(); | ||
} | ||
); | ||
].forEach(value => { | ||
it("should never crashes whatever the value is " + JSON.stringify(value), () => { | ||
expect(() => serializeError(value as any)).not.toThrow(); | ||
}); | ||
}); | ||
}); |
@@ -9,6 +9,3 @@ /* eslint-disable no-continue */ | ||
export const addCustomErrorDeserializer = ( | ||
name: string, | ||
deserializer: (obj: any) => any | ||
): void => { | ||
export const addCustomErrorDeserializer = (name: string, deserializer: (obj: any) => any): void => { | ||
deserializers[name] = deserializer; | ||
@@ -26,5 +23,5 @@ }; | ||
F extends { [key: string]: unknown }, | ||
T extends LedgerErrorConstructor<F> | ||
T extends LedgerErrorConstructor<F>, | ||
>( | ||
name: string | ||
name: string, | ||
): T => { | ||
@@ -47,8 +44,3 @@ class CustomErrorClass extends Error { | ||
} | ||
if ( | ||
options && | ||
isObject(options) && | ||
"cause" in options && | ||
!("cause" in this) | ||
) { | ||
if (options && isObject(options) && "cause" in options && !("cause" in this)) { | ||
// .cause was specified but the superconstructor | ||
@@ -129,3 +121,3 @@ // did not create an instance property. | ||
export const serializeError = ( | ||
value: undefined | To | string | (() => unknown) | ||
value: undefined | To | string | (() => unknown), | ||
): undefined | To | string => { | ||
@@ -132,0 +124,0 @@ if (!value) return value; |
@@ -1,2 +0,2 @@ | ||
import { AmountRequired, CurrencyNotSupported } from "./index"; | ||
import { AmountRequired, CurrencyNotSupported, TransportStatusError, StatusCodes } from "./index"; | ||
@@ -23,3 +23,3 @@ function functionA() { | ||
`AmountRequired: AmountRequired | ||
at functionA` | ||
at functionA`, | ||
); | ||
@@ -43,3 +43,3 @@ } | ||
// FIXME it's not yet the good type here | ||
e instanceof CurrencyNotSupported && (e as any).currencyName | ||
e instanceof CurrencyNotSupported && (e as any).currencyName, | ||
).toEqual("foo"); | ||
@@ -70,5 +70,3 @@ } | ||
test("promise error instanceof", () => { | ||
expect(Promise.reject(new AmountRequired())).rejects.toBeInstanceOf( | ||
AmountRequired | ||
); | ||
expect(Promise.reject(new AmountRequired())).rejects.toBeInstanceOf(AmountRequired); | ||
}); | ||
@@ -80,2 +78,7 @@ | ||
}); | ||
test("transport status error contains message", () => { | ||
const error: Error = new TransportStatusError(StatusCodes.UNKNOWN_APDU); | ||
expect(error.stack).toContain("Ledger device: UNKNOWN_APDU (0x6d02)"); | ||
}); | ||
}); |
235
src/index.ts
@@ -9,15 +9,6 @@ import { | ||
export { | ||
serializeError, | ||
deserializeError, | ||
createCustomErrorClass, | ||
addCustomErrorDeserializer, | ||
}; | ||
export { serializeError, deserializeError, createCustomErrorClass, addCustomErrorDeserializer }; | ||
export const AccountNameRequiredError = createCustomErrorClass( | ||
"AccountNameRequired" | ||
); | ||
export const AccountNotSupported = createCustomErrorClass( | ||
"AccountNotSupported" | ||
); | ||
export const AccountNameRequiredError = createCustomErrorClass("AccountNameRequired"); | ||
export const AccountNotSupported = createCustomErrorClass("AccountNotSupported"); | ||
export const AmountRequired = createCustomErrorClass("AmountRequired"); | ||
@@ -27,8 +18,4 @@ export const BluetoothRequired = createCustomErrorClass("BluetoothRequired"); | ||
export const CantOpenDevice = createCustomErrorClass("CantOpenDevice"); | ||
export const CashAddrNotSupported = createCustomErrorClass( | ||
"CashAddrNotSupported" | ||
); | ||
export const ClaimRewardsFeesWarning = createCustomErrorClass( | ||
"ClaimRewardsFeesWarning" | ||
); | ||
export const CashAddrNotSupported = createCustomErrorClass("CashAddrNotSupported"); | ||
export const ClaimRewardsFeesWarning = createCustomErrorClass("ClaimRewardsFeesWarning"); | ||
export const CurrencyNotSupported = createCustomErrorClass< | ||
@@ -38,185 +25,109 @@ { currencyName: string }, | ||
>("CurrencyNotSupported"); | ||
export const DeviceAppVerifyNotSupported = createCustomErrorClass( | ||
"DeviceAppVerifyNotSupported" | ||
); | ||
export const DeviceAppVerifyNotSupported = createCustomErrorClass("DeviceAppVerifyNotSupported"); | ||
export const DeviceGenuineSocketEarlyClose = createCustomErrorClass( | ||
"DeviceGenuineSocketEarlyClose" | ||
"DeviceGenuineSocketEarlyClose", | ||
); | ||
export const DeviceNotGenuineError = createCustomErrorClass("DeviceNotGenuine"); | ||
export const DeviceOnDashboardExpected = createCustomErrorClass( | ||
"DeviceOnDashboardExpected" | ||
); | ||
export const DeviceOnDashboardUnexpected = createCustomErrorClass( | ||
"DeviceOnDashboardUnexpected" | ||
); | ||
export const DeviceInOSUExpected = createCustomErrorClass( | ||
"DeviceInOSUExpected" | ||
); | ||
export const DeviceOnDashboardExpected = createCustomErrorClass("DeviceOnDashboardExpected"); | ||
export const DeviceOnDashboardUnexpected = createCustomErrorClass("DeviceOnDashboardUnexpected"); | ||
export const DeviceInOSUExpected = createCustomErrorClass("DeviceInOSUExpected"); | ||
export const DeviceHalted = createCustomErrorClass("DeviceHalted"); | ||
export const DeviceNameInvalid = createCustomErrorClass("DeviceNameInvalid"); | ||
export const DeviceSocketFail = createCustomErrorClass("DeviceSocketFail"); | ||
export const DeviceSocketNoBulkStatus = createCustomErrorClass( | ||
"DeviceSocketNoBulkStatus" | ||
); | ||
export const DeviceSocketNoBulkStatus = createCustomErrorClass("DeviceSocketNoBulkStatus"); | ||
export const LockedDeviceError = createCustomErrorClass("LockedDeviceError"); | ||
export const DisconnectedDevice = createCustomErrorClass("DisconnectedDevice"); | ||
export const DisconnectedDeviceDuringOperation = createCustomErrorClass( | ||
"DisconnectedDeviceDuringOperation" | ||
"DisconnectedDeviceDuringOperation", | ||
); | ||
export const DeviceExtractOnboardingStateError = createCustomErrorClass( | ||
"DeviceExtractOnboardingStateError" | ||
"DeviceExtractOnboardingStateError", | ||
); | ||
export const DeviceOnboardingStatePollingError = createCustomErrorClass( | ||
"DeviceOnboardingStatePollingError" | ||
"DeviceOnboardingStatePollingError", | ||
); | ||
export const EnpointConfigError = createCustomErrorClass("EnpointConfig"); | ||
export const EthAppPleaseEnableContractData = createCustomErrorClass( | ||
"EthAppPleaseEnableContractData" | ||
"EthAppPleaseEnableContractData", | ||
); | ||
export const FeeEstimationFailed = createCustomErrorClass( | ||
"FeeEstimationFailed" | ||
); | ||
export const FirmwareNotRecognized = createCustomErrorClass( | ||
"FirmwareNotRecognized" | ||
); | ||
export const FeeEstimationFailed = createCustomErrorClass("FeeEstimationFailed"); | ||
export const FirmwareNotRecognized = createCustomErrorClass("FirmwareNotRecognized"); | ||
export const HardResetFail = createCustomErrorClass("HardResetFail"); | ||
export const InvalidXRPTag = createCustomErrorClass("InvalidXRPTag"); | ||
export const InvalidAddress = createCustomErrorClass("InvalidAddress"); | ||
export const InvalidAddressBecauseDestinationIsAlsoSource = | ||
createCustomErrorClass("InvalidAddressBecauseDestinationIsAlsoSource"); | ||
export const LatestMCUInstalledError = createCustomErrorClass( | ||
"LatestMCUInstalledError" | ||
export const InvalidAddressBecauseDestinationIsAlsoSource = createCustomErrorClass( | ||
"InvalidAddressBecauseDestinationIsAlsoSource", | ||
); | ||
export const LatestMCUInstalledError = createCustomErrorClass("LatestMCUInstalledError"); | ||
export const UnknownMCU = createCustomErrorClass("UnknownMCU"); | ||
export const LedgerAPIError = createCustomErrorClass("LedgerAPIError"); | ||
export const LedgerAPIErrorWithMessage = createCustomErrorClass( | ||
"LedgerAPIErrorWithMessage" | ||
); | ||
export const LedgerAPINotAvailable = createCustomErrorClass( | ||
"LedgerAPINotAvailable" | ||
); | ||
export const ManagerAppAlreadyInstalledError = createCustomErrorClass( | ||
"ManagerAppAlreadyInstalled" | ||
); | ||
export const ManagerAppRelyOnBTCError = createCustomErrorClass( | ||
"ManagerAppRelyOnBTC" | ||
); | ||
export const ManagerAppDepInstallRequired = createCustomErrorClass( | ||
"ManagerAppDepInstallRequired" | ||
); | ||
export const LedgerAPIErrorWithMessage = createCustomErrorClass("LedgerAPIErrorWithMessage"); | ||
export const LedgerAPINotAvailable = createCustomErrorClass("LedgerAPINotAvailable"); | ||
export const ManagerAppAlreadyInstalledError = createCustomErrorClass("ManagerAppAlreadyInstalled"); | ||
export const ManagerAppRelyOnBTCError = createCustomErrorClass("ManagerAppRelyOnBTC"); | ||
export const ManagerAppDepInstallRequired = createCustomErrorClass("ManagerAppDepInstallRequired"); | ||
export const ManagerAppDepUninstallRequired = createCustomErrorClass( | ||
"ManagerAppDepUninstallRequired" | ||
"ManagerAppDepUninstallRequired", | ||
); | ||
export const ManagerDeviceLockedError = createCustomErrorClass( | ||
"ManagerDeviceLocked" | ||
); | ||
export const ManagerDeviceLockedError = createCustomErrorClass("ManagerDeviceLocked"); | ||
export const ManagerFirmwareNotEnoughSpaceError = createCustomErrorClass( | ||
"ManagerFirmwareNotEnoughSpace" | ||
"ManagerFirmwareNotEnoughSpace", | ||
); | ||
export const ManagerNotEnoughSpaceError = createCustomErrorClass( | ||
"ManagerNotEnoughSpace" | ||
); | ||
export const ManagerUninstallBTCDep = createCustomErrorClass( | ||
"ManagerUninstallBTCDep" | ||
); | ||
export const ManagerNotEnoughSpaceError = createCustomErrorClass("ManagerNotEnoughSpace"); | ||
export const ManagerUninstallBTCDep = createCustomErrorClass("ManagerUninstallBTCDep"); | ||
export const NetworkDown = createCustomErrorClass("NetworkDown"); | ||
export const NoAddressesFound = createCustomErrorClass("NoAddressesFound"); | ||
export const NotEnoughBalance = createCustomErrorClass("NotEnoughBalance"); | ||
export const NotEnoughBalanceToDelegate = createCustomErrorClass( | ||
"NotEnoughBalanceToDelegate" | ||
); | ||
export const NotEnoughBalanceToDelegate = createCustomErrorClass("NotEnoughBalanceToDelegate"); | ||
export const NotEnoughBalanceInParentAccount = createCustomErrorClass( | ||
"NotEnoughBalanceInParentAccount" | ||
"NotEnoughBalanceInParentAccount", | ||
); | ||
export const NotEnoughSpendableBalance = createCustomErrorClass( | ||
"NotEnoughSpendableBalance" | ||
export const NotEnoughSpendableBalance = createCustomErrorClass("NotEnoughSpendableBalance"); | ||
export const NotEnoughBalanceBecauseDestinationNotCreated = createCustomErrorClass( | ||
"NotEnoughBalanceBecauseDestinationNotCreated", | ||
); | ||
export const NotEnoughBalanceBecauseDestinationNotCreated = | ||
createCustomErrorClass("NotEnoughBalanceBecauseDestinationNotCreated"); | ||
export const NoAccessToCamera = createCustomErrorClass("NoAccessToCamera"); | ||
export const NotEnoughGas = createCustomErrorClass("NotEnoughGas"); | ||
export const NotSupportedLegacyAddress = createCustomErrorClass( | ||
"NotSupportedLegacyAddress" | ||
); | ||
export const GasLessThanEstimate = createCustomErrorClass( | ||
"GasLessThanEstimate" | ||
); | ||
export const NotSupportedLegacyAddress = createCustomErrorClass("NotSupportedLegacyAddress"); | ||
export const GasLessThanEstimate = createCustomErrorClass("GasLessThanEstimate"); | ||
export const PriorityFeeTooLow = createCustomErrorClass("PriorityFeeTooLow"); | ||
export const PriorityFeeTooHigh = createCustomErrorClass("PriorityFeeTooHigh"); | ||
export const PriorityFeeHigherThanMaxFee = createCustomErrorClass( | ||
"PriorityFeeHigherThanMaxFee" | ||
); | ||
export const PriorityFeeHigherThanMaxFee = createCustomErrorClass("PriorityFeeHigherThanMaxFee"); | ||
export const MaxFeeTooLow = createCustomErrorClass("MaxFeeTooLow"); | ||
export const PasswordsDontMatchError = | ||
createCustomErrorClass("PasswordsDontMatch"); | ||
export const PasswordIncorrectError = | ||
createCustomErrorClass("PasswordIncorrect"); | ||
export const RecommendSubAccountsToEmpty = createCustomErrorClass( | ||
"RecommendSubAccountsToEmpty" | ||
); | ||
export const RecommendUndelegation = createCustomErrorClass( | ||
"RecommendUndelegation" | ||
); | ||
export const PasswordsDontMatchError = createCustomErrorClass("PasswordsDontMatch"); | ||
export const PasswordIncorrectError = createCustomErrorClass("PasswordIncorrect"); | ||
export const RecommendSubAccountsToEmpty = createCustomErrorClass("RecommendSubAccountsToEmpty"); | ||
export const RecommendUndelegation = createCustomErrorClass("RecommendUndelegation"); | ||
export const TimeoutTagged = createCustomErrorClass("TimeoutTagged"); | ||
export const UnexpectedBootloader = createCustomErrorClass( | ||
"UnexpectedBootloader" | ||
); | ||
export const MCUNotGenuineToDashboard = createCustomErrorClass( | ||
"MCUNotGenuineToDashboard" | ||
); | ||
export const UnexpectedBootloader = createCustomErrorClass("UnexpectedBootloader"); | ||
export const MCUNotGenuineToDashboard = createCustomErrorClass("MCUNotGenuineToDashboard"); | ||
export const RecipientRequired = createCustomErrorClass("RecipientRequired"); | ||
export const UnavailableTezosOriginatedAccountReceive = createCustomErrorClass( | ||
"UnavailableTezosOriginatedAccountReceive" | ||
"UnavailableTezosOriginatedAccountReceive", | ||
); | ||
export const UnavailableTezosOriginatedAccountSend = createCustomErrorClass( | ||
"UnavailableTezosOriginatedAccountSend" | ||
"UnavailableTezosOriginatedAccountSend", | ||
); | ||
export const UpdateFetchFileFail = createCustomErrorClass( | ||
"UpdateFetchFileFail" | ||
); | ||
export const UpdateIncorrectHash = createCustomErrorClass( | ||
"UpdateIncorrectHash" | ||
); | ||
export const UpdateFetchFileFail = createCustomErrorClass("UpdateFetchFileFail"); | ||
export const UpdateIncorrectHash = createCustomErrorClass("UpdateIncorrectHash"); | ||
export const UpdateIncorrectSig = createCustomErrorClass("UpdateIncorrectSig"); | ||
export const UpdateYourApp = createCustomErrorClass("UpdateYourApp"); | ||
export const UserRefusedDeviceNameChange = createCustomErrorClass( | ||
"UserRefusedDeviceNameChange" | ||
); | ||
export const UserRefusedDeviceNameChange = createCustomErrorClass("UserRefusedDeviceNameChange"); | ||
export const UserRefusedAddress = createCustomErrorClass("UserRefusedAddress"); | ||
export const UserRefusedFirmwareUpdate = createCustomErrorClass( | ||
"UserRefusedFirmwareUpdate" | ||
); | ||
export const UserRefusedAllowManager = createCustomErrorClass( | ||
"UserRefusedAllowManager" | ||
); | ||
export const UserRefusedOnDevice = createCustomErrorClass( | ||
"UserRefusedOnDevice" | ||
); // TODO rename because it's just for transaction refusal | ||
export const TransportOpenUserCancelled = createCustomErrorClass( | ||
"TransportOpenUserCancelled" | ||
); | ||
export const UserRefusedFirmwareUpdate = createCustomErrorClass("UserRefusedFirmwareUpdate"); | ||
export const UserRefusedAllowManager = createCustomErrorClass("UserRefusedAllowManager"); | ||
export const UserRefusedOnDevice = createCustomErrorClass("UserRefusedOnDevice"); // TODO rename because it's just for transaction refusal | ||
export const TransportOpenUserCancelled = createCustomErrorClass("TransportOpenUserCancelled"); | ||
export const TransportInterfaceNotAvailable = createCustomErrorClass( | ||
"TransportInterfaceNotAvailable" | ||
"TransportInterfaceNotAvailable", | ||
); | ||
export const TransportRaceCondition = createCustomErrorClass( | ||
"TransportRaceCondition" | ||
); | ||
export const TransportRaceCondition = createCustomErrorClass("TransportRaceCondition"); | ||
export const TransportWebUSBGestureRequired = createCustomErrorClass( | ||
"TransportWebUSBGestureRequired" | ||
"TransportWebUSBGestureRequired", | ||
); | ||
export const DeviceShouldStayInApp = createCustomErrorClass( | ||
"DeviceShouldStayInApp" | ||
); | ||
export const WebsocketConnectionError = createCustomErrorClass( | ||
"WebsocketConnectionError" | ||
); | ||
export const WebsocketConnectionFailed = createCustomErrorClass( | ||
"WebsocketConnectionFailed" | ||
); | ||
export const WrongDeviceForAccount = createCustomErrorClass( | ||
"WrongDeviceForAccount" | ||
); | ||
export const WrongAppForCurrency = createCustomErrorClass( | ||
"WrongAppForCurrency" | ||
); | ||
export const DeviceShouldStayInApp = createCustomErrorClass("DeviceShouldStayInApp"); | ||
export const WebsocketConnectionError = createCustomErrorClass("WebsocketConnectionError"); | ||
export const WebsocketConnectionFailed = createCustomErrorClass("WebsocketConnectionFailed"); | ||
export const WrongDeviceForAccount = createCustomErrorClass("WrongDeviceForAccount"); | ||
export const WrongAppForCurrency = createCustomErrorClass("WrongAppForCurrency"); | ||
export const ETHAddressNonEIP = createCustomErrorClass("ETHAddressNonEIP"); | ||
@@ -234,9 +145,6 @@ export const CantScanQRCode = createCustomErrorClass("CantScanQRCode"); | ||
export const LedgerAPI5xx = createCustomErrorClass("LedgerAPI5xx"); | ||
export const FirmwareOrAppUpdateRequired = createCustomErrorClass( | ||
"FirmwareOrAppUpdateRequired" | ||
); | ||
export const FirmwareOrAppUpdateRequired = createCustomErrorClass("FirmwareOrAppUpdateRequired"); | ||
// Bitcoin family | ||
export const OpReturnDataSizeLimit = | ||
createCustomErrorClass("OpReturnSizeLimit"); | ||
export const OpReturnDataSizeLimit = createCustomErrorClass("OpReturnSizeLimit"); | ||
export const DustLimit = createCustomErrorClass("DustLimit"); | ||
@@ -293,3 +201,3 @@ | ||
this.message = message; | ||
this.stack = new Error().stack; | ||
this.stack = new Error(message).stack; | ||
this.id = id; | ||
@@ -299,6 +207,3 @@ } | ||
addCustomErrorDeserializer( | ||
"TransportError", | ||
(e) => new TransportError(e.message, e.id) | ||
); | ||
addCustomErrorDeserializer("TransportError", e => new TransportError(e.message, e.id)); | ||
@@ -376,4 +281,3 @@ export const StatusCodes = { | ||
const statusText = | ||
Object.keys(StatusCodes).find((k) => StatusCodes[k] === statusCode) || | ||
"UNKNOWN_ERROR"; | ||
Object.keys(StatusCodes).find(k => StatusCodes[k] === statusCode) || "UNKNOWN_ERROR"; | ||
const smsg = getAltStatusMessage(statusCode) || statusText; | ||
@@ -390,3 +294,3 @@ const statusCodeStr = statusCode.toString(16); | ||
this.message = message; | ||
this.stack = new Error().stack; | ||
this.stack = new Error(message).stack; | ||
this.statusCode = statusCode; | ||
@@ -397,5 +301,2 @@ this.statusText = statusText; | ||
addCustomErrorDeserializer( | ||
"TransportStatusError", | ||
(e) => new TransportStatusError(e.statusCode) | ||
); | ||
addCustomErrorDeserializer("TransportStatusError", e => new TransportStatusError(e.statusCode)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
161958
2404
1