@ledgerhq/errors 6.10.1-monorepo.0 → 6.10.1-monorepo.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js ADDED
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.NotEnoughBalanceInParentAccount = exports.NotEnoughBalanceToDelegate = exports.NotEnoughBalance = exports.NoAddressesFound = exports.NetworkDown = exports.ManagerUninstallBTCDep = exports.ManagerNotEnoughSpaceError = exports.ManagerFirmwareNotEnoughSpaceError = exports.ManagerDeviceLockedError = exports.ManagerAppDepUninstallRequired = exports.ManagerAppDepInstallRequired = exports.ManagerAppRelyOnBTCError = exports.ManagerAppAlreadyInstalledError = exports.LedgerAPINotAvailable = exports.LedgerAPIErrorWithMessage = exports.LedgerAPIError = exports.UnknownMCU = exports.LatestMCUInstalledError = exports.InvalidAddressBecauseDestinationIsAlsoSource = exports.InvalidAddress = exports.InvalidXRPTag = exports.HardResetFail = exports.FirmwareNotRecognized = exports.FeeEstimationFailed = exports.EthAppPleaseEnableContractData = exports.EnpointConfigError = exports.DisconnectedDeviceDuringOperation = exports.DisconnectedDevice = exports.DeviceSocketNoBulkStatus = exports.DeviceSocketFail = exports.DeviceNameInvalid = exports.DeviceHalted = exports.DeviceInOSUExpected = exports.DeviceOnDashboardUnexpected = exports.DeviceOnDashboardExpected = exports.DeviceNotGenuineError = exports.DeviceGenuineSocketEarlyClose = exports.DeviceAppVerifyNotSupported = exports.CurrencyNotSupported = exports.CashAddrNotSupported = exports.CantOpenDevice = exports.BtcUnmatchedApp = exports.BluetoothRequired = exports.AmountRequired = exports.AccountNotSupported = exports.AccountNameRequiredError = exports.addCustomErrorDeserializer = exports.createCustomErrorClass = exports.deserializeError = exports.serializeError = void 0;
4
+ exports.StatusCodes = exports.TransportError = exports.DBNotReset = exports.DBWrongPassword = exports.NoDBPathGiven = exports.FirmwareOrAppUpdateRequired = exports.LedgerAPI5xx = exports.LedgerAPI4xx = exports.GenuineCheckFailed = exports.PairingFailed = exports.SyncError = exports.FeeTooHigh = exports.FeeRequired = exports.FeeNotLoaded = exports.CantScanQRCode = exports.ETHAddressNonEIP = exports.WrongAppForCurrency = exports.WrongDeviceForAccount = exports.WebsocketConnectionFailed = exports.WebsocketConnectionError = exports.DeviceShouldStayInApp = exports.TransportWebUSBGestureRequired = exports.TransportRaceCondition = exports.TransportInterfaceNotAvailable = exports.TransportOpenUserCancelled = exports.UserRefusedOnDevice = exports.UserRefusedAllowManager = exports.UserRefusedFirmwareUpdate = exports.UserRefusedAddress = exports.UserRefusedDeviceNameChange = exports.UpdateYourApp = exports.UpdateIncorrectSig = exports.UpdateIncorrectHash = exports.UpdateFetchFileFail = exports.UnavailableTezosOriginatedAccountSend = exports.UnavailableTezosOriginatedAccountReceive = exports.RecipientRequired = exports.MCUNotGenuineToDashboard = exports.UnexpectedBootloader = exports.TimeoutTagged = exports.RecommendUndelegation = exports.RecommendSubAccountsToEmpty = exports.PasswordIncorrectError = exports.PasswordsDontMatchError = exports.GasLessThanEstimate = exports.NotSupportedLegacyAddress = exports.NotEnoughGas = exports.NoAccessToCamera = exports.NotEnoughBalanceBecauseDestinationNotCreated = exports.NotEnoughSpendableBalance = void 0;
5
+ exports.TransportStatusError = exports.getAltStatusMessage = void 0;
6
+ var helpers_1 = require("./helpers");
7
+ exports.serializeError = helpers_1.serializeError;
8
+ exports.deserializeError = helpers_1.deserializeError;
9
+ exports.createCustomErrorClass = helpers_1.createCustomErrorClass;
10
+ exports.addCustomErrorDeserializer = helpers_1.addCustomErrorDeserializer;
11
+ exports.AccountNameRequiredError = (0, helpers_1.createCustomErrorClass)("AccountNameRequired");
12
+ exports.AccountNotSupported = (0, helpers_1.createCustomErrorClass)("AccountNotSupported");
13
+ exports.AmountRequired = (0, helpers_1.createCustomErrorClass)("AmountRequired");
14
+ exports.BluetoothRequired = (0, helpers_1.createCustomErrorClass)("BluetoothRequired");
15
+ exports.BtcUnmatchedApp = (0, helpers_1.createCustomErrorClass)("BtcUnmatchedApp");
16
+ exports.CantOpenDevice = (0, helpers_1.createCustomErrorClass)("CantOpenDevice");
17
+ exports.CashAddrNotSupported = (0, helpers_1.createCustomErrorClass)("CashAddrNotSupported");
18
+ exports.CurrencyNotSupported = (0, helpers_1.createCustomErrorClass)("CurrencyNotSupported");
19
+ exports.DeviceAppVerifyNotSupported = (0, helpers_1.createCustomErrorClass)("DeviceAppVerifyNotSupported");
20
+ exports.DeviceGenuineSocketEarlyClose = (0, helpers_1.createCustomErrorClass)("DeviceGenuineSocketEarlyClose");
21
+ exports.DeviceNotGenuineError = (0, helpers_1.createCustomErrorClass)("DeviceNotGenuine");
22
+ exports.DeviceOnDashboardExpected = (0, helpers_1.createCustomErrorClass)("DeviceOnDashboardExpected");
23
+ exports.DeviceOnDashboardUnexpected = (0, helpers_1.createCustomErrorClass)("DeviceOnDashboardUnexpected");
24
+ exports.DeviceInOSUExpected = (0, helpers_1.createCustomErrorClass)("DeviceInOSUExpected");
25
+ exports.DeviceHalted = (0, helpers_1.createCustomErrorClass)("DeviceHalted");
26
+ exports.DeviceNameInvalid = (0, helpers_1.createCustomErrorClass)("DeviceNameInvalid");
27
+ exports.DeviceSocketFail = (0, helpers_1.createCustomErrorClass)("DeviceSocketFail");
28
+ exports.DeviceSocketNoBulkStatus = (0, helpers_1.createCustomErrorClass)("DeviceSocketNoBulkStatus");
29
+ exports.DisconnectedDevice = (0, helpers_1.createCustomErrorClass)("DisconnectedDevice");
30
+ exports.DisconnectedDeviceDuringOperation = (0, helpers_1.createCustomErrorClass)("DisconnectedDeviceDuringOperation");
31
+ exports.EnpointConfigError = (0, helpers_1.createCustomErrorClass)("EnpointConfig");
32
+ exports.EthAppPleaseEnableContractData = (0, helpers_1.createCustomErrorClass)("EthAppPleaseEnableContractData");
33
+ exports.FeeEstimationFailed = (0, helpers_1.createCustomErrorClass)("FeeEstimationFailed");
34
+ exports.FirmwareNotRecognized = (0, helpers_1.createCustomErrorClass)("FirmwareNotRecognized");
35
+ exports.HardResetFail = (0, helpers_1.createCustomErrorClass)("HardResetFail");
36
+ exports.InvalidXRPTag = (0, helpers_1.createCustomErrorClass)("InvalidXRPTag");
37
+ exports.InvalidAddress = (0, helpers_1.createCustomErrorClass)("InvalidAddress");
38
+ exports.InvalidAddressBecauseDestinationIsAlsoSource = (0, helpers_1.createCustomErrorClass)("InvalidAddressBecauseDestinationIsAlsoSource");
39
+ exports.LatestMCUInstalledError = (0, helpers_1.createCustomErrorClass)("LatestMCUInstalledError");
40
+ exports.UnknownMCU = (0, helpers_1.createCustomErrorClass)("UnknownMCU");
41
+ exports.LedgerAPIError = (0, helpers_1.createCustomErrorClass)("LedgerAPIError");
42
+ exports.LedgerAPIErrorWithMessage = (0, helpers_1.createCustomErrorClass)("LedgerAPIErrorWithMessage");
43
+ exports.LedgerAPINotAvailable = (0, helpers_1.createCustomErrorClass)("LedgerAPINotAvailable");
44
+ exports.ManagerAppAlreadyInstalledError = (0, helpers_1.createCustomErrorClass)("ManagerAppAlreadyInstalled");
45
+ exports.ManagerAppRelyOnBTCError = (0, helpers_1.createCustomErrorClass)("ManagerAppRelyOnBTC");
46
+ exports.ManagerAppDepInstallRequired = (0, helpers_1.createCustomErrorClass)("ManagerAppDepInstallRequired");
47
+ exports.ManagerAppDepUninstallRequired = (0, helpers_1.createCustomErrorClass)("ManagerAppDepUninstallRequired");
48
+ exports.ManagerDeviceLockedError = (0, helpers_1.createCustomErrorClass)("ManagerDeviceLocked");
49
+ exports.ManagerFirmwareNotEnoughSpaceError = (0, helpers_1.createCustomErrorClass)("ManagerFirmwareNotEnoughSpace");
50
+ exports.ManagerNotEnoughSpaceError = (0, helpers_1.createCustomErrorClass)("ManagerNotEnoughSpace");
51
+ exports.ManagerUninstallBTCDep = (0, helpers_1.createCustomErrorClass)("ManagerUninstallBTCDep");
52
+ exports.NetworkDown = (0, helpers_1.createCustomErrorClass)("NetworkDown");
53
+ exports.NoAddressesFound = (0, helpers_1.createCustomErrorClass)("NoAddressesFound");
54
+ exports.NotEnoughBalance = (0, helpers_1.createCustomErrorClass)("NotEnoughBalance");
55
+ exports.NotEnoughBalanceToDelegate = (0, helpers_1.createCustomErrorClass)("NotEnoughBalanceToDelegate");
56
+ exports.NotEnoughBalanceInParentAccount = (0, helpers_1.createCustomErrorClass)("NotEnoughBalanceInParentAccount");
57
+ exports.NotEnoughSpendableBalance = (0, helpers_1.createCustomErrorClass)("NotEnoughSpendableBalance");
58
+ exports.NotEnoughBalanceBecauseDestinationNotCreated = (0, helpers_1.createCustomErrorClass)("NotEnoughBalanceBecauseDestinationNotCreated");
59
+ exports.NoAccessToCamera = (0, helpers_1.createCustomErrorClass)("NoAccessToCamera");
60
+ exports.NotEnoughGas = (0, helpers_1.createCustomErrorClass)("NotEnoughGas");
61
+ exports.NotSupportedLegacyAddress = (0, helpers_1.createCustomErrorClass)("NotSupportedLegacyAddress");
62
+ exports.GasLessThanEstimate = (0, helpers_1.createCustomErrorClass)("GasLessThanEstimate");
63
+ exports.PasswordsDontMatchError = (0, helpers_1.createCustomErrorClass)("PasswordsDontMatch");
64
+ exports.PasswordIncorrectError = (0, helpers_1.createCustomErrorClass)("PasswordIncorrect");
65
+ exports.RecommendSubAccountsToEmpty = (0, helpers_1.createCustomErrorClass)("RecommendSubAccountsToEmpty");
66
+ exports.RecommendUndelegation = (0, helpers_1.createCustomErrorClass)("RecommendUndelegation");
67
+ exports.TimeoutTagged = (0, helpers_1.createCustomErrorClass)("TimeoutTagged");
68
+ exports.UnexpectedBootloader = (0, helpers_1.createCustomErrorClass)("UnexpectedBootloader");
69
+ exports.MCUNotGenuineToDashboard = (0, helpers_1.createCustomErrorClass)("MCUNotGenuineToDashboard");
70
+ exports.RecipientRequired = (0, helpers_1.createCustomErrorClass)("RecipientRequired");
71
+ exports.UnavailableTezosOriginatedAccountReceive = (0, helpers_1.createCustomErrorClass)("UnavailableTezosOriginatedAccountReceive");
72
+ exports.UnavailableTezosOriginatedAccountSend = (0, helpers_1.createCustomErrorClass)("UnavailableTezosOriginatedAccountSend");
73
+ exports.UpdateFetchFileFail = (0, helpers_1.createCustomErrorClass)("UpdateFetchFileFail");
74
+ exports.UpdateIncorrectHash = (0, helpers_1.createCustomErrorClass)("UpdateIncorrectHash");
75
+ exports.UpdateIncorrectSig = (0, helpers_1.createCustomErrorClass)("UpdateIncorrectSig");
76
+ exports.UpdateYourApp = (0, helpers_1.createCustomErrorClass)("UpdateYourApp");
77
+ exports.UserRefusedDeviceNameChange = (0, helpers_1.createCustomErrorClass)("UserRefusedDeviceNameChange");
78
+ exports.UserRefusedAddress = (0, helpers_1.createCustomErrorClass)("UserRefusedAddress");
79
+ exports.UserRefusedFirmwareUpdate = (0, helpers_1.createCustomErrorClass)("UserRefusedFirmwareUpdate");
80
+ exports.UserRefusedAllowManager = (0, helpers_1.createCustomErrorClass)("UserRefusedAllowManager");
81
+ exports.UserRefusedOnDevice = (0, helpers_1.createCustomErrorClass)("UserRefusedOnDevice"); // TODO rename because it's just for transaction refusal
82
+ exports.TransportOpenUserCancelled = (0, helpers_1.createCustomErrorClass)("TransportOpenUserCancelled");
83
+ exports.TransportInterfaceNotAvailable = (0, helpers_1.createCustomErrorClass)("TransportInterfaceNotAvailable");
84
+ exports.TransportRaceCondition = (0, helpers_1.createCustomErrorClass)("TransportRaceCondition");
85
+ exports.TransportWebUSBGestureRequired = (0, helpers_1.createCustomErrorClass)("TransportWebUSBGestureRequired");
86
+ exports.DeviceShouldStayInApp = (0, helpers_1.createCustomErrorClass)("DeviceShouldStayInApp");
87
+ exports.WebsocketConnectionError = (0, helpers_1.createCustomErrorClass)("WebsocketConnectionError");
88
+ exports.WebsocketConnectionFailed = (0, helpers_1.createCustomErrorClass)("WebsocketConnectionFailed");
89
+ exports.WrongDeviceForAccount = (0, helpers_1.createCustomErrorClass)("WrongDeviceForAccount");
90
+ exports.WrongAppForCurrency = (0, helpers_1.createCustomErrorClass)("WrongAppForCurrency");
91
+ exports.ETHAddressNonEIP = (0, helpers_1.createCustomErrorClass)("ETHAddressNonEIP");
92
+ exports.CantScanQRCode = (0, helpers_1.createCustomErrorClass)("CantScanQRCode");
93
+ exports.FeeNotLoaded = (0, helpers_1.createCustomErrorClass)("FeeNotLoaded");
94
+ exports.FeeRequired = (0, helpers_1.createCustomErrorClass)("FeeRequired");
95
+ exports.FeeTooHigh = (0, helpers_1.createCustomErrorClass)("FeeTooHigh");
96
+ exports.SyncError = (0, helpers_1.createCustomErrorClass)("SyncError");
97
+ exports.PairingFailed = (0, helpers_1.createCustomErrorClass)("PairingFailed");
98
+ exports.GenuineCheckFailed = (0, helpers_1.createCustomErrorClass)("GenuineCheckFailed");
99
+ exports.LedgerAPI4xx = (0, helpers_1.createCustomErrorClass)("LedgerAPI4xx");
100
+ exports.LedgerAPI5xx = (0, helpers_1.createCustomErrorClass)("LedgerAPI5xx");
101
+ exports.FirmwareOrAppUpdateRequired = (0, helpers_1.createCustomErrorClass)("FirmwareOrAppUpdateRequired");
102
+ // db stuff, no need to translate
103
+ exports.NoDBPathGiven = (0, helpers_1.createCustomErrorClass)("NoDBPathGiven");
104
+ exports.DBWrongPassword = (0, helpers_1.createCustomErrorClass)("DBWrongPassword");
105
+ exports.DBNotReset = (0, helpers_1.createCustomErrorClass)("DBNotReset");
106
+ /**
107
+ * TransportError is used for any generic transport errors.
108
+ * e.g. Error thrown when data received by exchanges are incorrect or if exchanged failed to communicate with the device for various reason.
109
+ */
110
+ function TransportError(message, id) {
111
+ this.name = "TransportError";
112
+ this.message = message;
113
+ this.stack = new Error().stack;
114
+ this.id = id;
115
+ }
116
+ exports.TransportError = TransportError;
117
+ TransportError.prototype = new Error();
118
+ (0, helpers_1.addCustomErrorDeserializer)("TransportError", function (e) { return new TransportError(e.message, e.id); });
119
+ exports.StatusCodes = {
120
+ PIN_REMAINING_ATTEMPTS: 0x63c0,
121
+ INCORRECT_LENGTH: 0x6700,
122
+ MISSING_CRITICAL_PARAMETER: 0x6800,
123
+ COMMAND_INCOMPATIBLE_FILE_STRUCTURE: 0x6981,
124
+ SECURITY_STATUS_NOT_SATISFIED: 0x6982,
125
+ CONDITIONS_OF_USE_NOT_SATISFIED: 0x6985,
126
+ INCORRECT_DATA: 0x6a80,
127
+ NOT_ENOUGH_MEMORY_SPACE: 0x6a84,
128
+ REFERENCED_DATA_NOT_FOUND: 0x6a88,
129
+ FILE_ALREADY_EXISTS: 0x6a89,
130
+ INCORRECT_P1_P2: 0x6b00,
131
+ INS_NOT_SUPPORTED: 0x6d00,
132
+ CLA_NOT_SUPPORTED: 0x6e00,
133
+ TECHNICAL_PROBLEM: 0x6f00,
134
+ OK: 0x9000,
135
+ MEMORY_PROBLEM: 0x9240,
136
+ NO_EF_SELECTED: 0x9400,
137
+ INVALID_OFFSET: 0x9402,
138
+ FILE_NOT_FOUND: 0x9404,
139
+ INCONSISTENT_FILE: 0x9408,
140
+ ALGORITHM_NOT_SUPPORTED: 0x9484,
141
+ INVALID_KCV: 0x9485,
142
+ CODE_NOT_INITIALIZED: 0x9802,
143
+ ACCESS_CONDITION_NOT_FULFILLED: 0x9804,
144
+ CONTRADICTION_SECRET_CODE_STATUS: 0x9808,
145
+ CONTRADICTION_INVALIDATION: 0x9810,
146
+ CODE_BLOCKED: 0x9840,
147
+ MAX_VALUE_REACHED: 0x9850,
148
+ GP_AUTH_FAILED: 0x6300,
149
+ LICENSING: 0x6f42,
150
+ HALTED: 0x6faa
151
+ };
152
+ function getAltStatusMessage(code) {
153
+ switch (code) {
154
+ // improve text of most common errors
155
+ case 0x6700:
156
+ return "Incorrect length";
157
+ case 0x6800:
158
+ return "Missing critical parameter";
159
+ case 0x6982:
160
+ return "Security not satisfied (dongle locked or have invalid access rights)";
161
+ case 0x6985:
162
+ return "Condition of use not satisfied (denied by the user?)";
163
+ case 0x6a80:
164
+ return "Invalid data received";
165
+ case 0x6b00:
166
+ return "Invalid parameter received";
167
+ }
168
+ if (0x6f00 <= code && code <= 0x6fff) {
169
+ return "Internal error, please report";
170
+ }
171
+ }
172
+ exports.getAltStatusMessage = getAltStatusMessage;
173
+ /**
174
+ * Error thrown when a device returned a non success status.
175
+ * the error.statusCode is one of the `StatusCodes` exported by this library.
176
+ */
177
+ function TransportStatusError(statusCode) {
178
+ this.name = "TransportStatusError";
179
+ var statusText = Object.keys(exports.StatusCodes).find(function (k) { return exports.StatusCodes[k] === statusCode; }) ||
180
+ "UNKNOWN_ERROR";
181
+ var smsg = getAltStatusMessage(statusCode) || statusText;
182
+ var statusCodeStr = statusCode.toString(16);
183
+ this.message = "Ledger device: ".concat(smsg, " (0x").concat(statusCodeStr, ")");
184
+ this.stack = new Error().stack;
185
+ this.statusCode = statusCode;
186
+ this.statusText = statusText;
187
+ }
188
+ exports.TransportStatusError = TransportStatusError;
189
+ TransportStatusError.prototype = new Error();
190
+ (0, helpers_1.addCustomErrorDeserializer)("TransportStatusError", function (e) { return new TransportStatusError(e.statusCode); });
191
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,qCAKmB;AAGjB,yBAPA,wBAAc,CAOA;AACd,2BAPA,0BAAgB,CAOA;AAChB,iCAPA,gCAAsB,CAOA;AACtB,qCAPA,oCAA0B,CAOA;AAGf,QAAA,wBAAwB,GAAG,IAAA,gCAAsB,EAC5D,qBAAqB,CACtB,CAAC;AACW,QAAA,mBAAmB,GAAG,IAAA,gCAAsB,EACvD,qBAAqB,CACtB,CAAC;AACW,QAAA,cAAc,GAAG,IAAA,gCAAsB,EAAC,gBAAgB,CAAC,CAAC;AAC1D,QAAA,iBAAiB,GAAG,IAAA,gCAAsB,EAAC,mBAAmB,CAAC,CAAC;AAChE,QAAA,eAAe,GAAG,IAAA,gCAAsB,EAAC,iBAAiB,CAAC,CAAC;AAC5D,QAAA,cAAc,GAAG,IAAA,gCAAsB,EAAC,gBAAgB,CAAC,CAAC;AAC1D,QAAA,oBAAoB,GAAG,IAAA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YACT,OAAO,sDAAsD,CAAC;QAChE,KAAK,MAAM;YACT,OAAO,uBAAuB,CAAC;QACjC,KAAK,MAAM;YACT,OAAO,4BAA4B,CAAC;KACvC;IACD,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM,EAAE;QACpC,OAAO,+BAA+B,CAAC;KACxC;AACH,CAAC;AAnBD,kDAmBC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,UAAkB;IACrD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACnC,IAAM,UAAU,GACd,MAAM,CAAC,IAAI,CAAC,mBAAW,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,mBAAW,CAAC,CAAC,CAAC,KAAK,UAAU,EAA7B,CAA6B,CAAC;QACnE,eAAe,CAAC;IAClB,IAAM,IAAI,GAAG,mBAAmB,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC;IAC3D,IAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO,GAAG,yBAAkB,IAAI,iBAAO,aAAa,MAAG,CAAC;IAC7D,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;AAC/B,CAAC;AAXD,oDAWC;AACD,oBAAoB,CAAC,SAAS,GAAG,IAAI,KAAK,EAAE,CAAC;AAE7C,IAAA,oCAA0B,EACxB,sBAAsB,EACtB,UAAC,CAAC,IAAK,OAAA,IAAI,oBAAoB,CAAC,CAAC,CAAC,UAAU,CAAC,EAAtC,CAAsC,CAC9C,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const addCustomErrorDeserializer: (name: string, deserializer: (obj: any) => any) => void;
2
+ declare type CustomErrorFunc = (message?: string, fields?: {
3
+ [key: string]: any;
4
+ }) => void;
5
+ export declare const createCustomErrorClass: (name: string) => CustomErrorFunc;
6
+ export declare const deserializeError: (object: any) => Error;
7
+ export declare const serializeError: (value: any) => undefined | To | string;
8
+ interface To {
9
+ name?: string;
10
+ message?: string;
11
+ stack?: string;
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,0BAA0B,SAC/B,MAAM,sBACQ,GAAG,KAAK,GAAG,KAC9B,IAEF,CAAC;AAEF,aAAK,eAAe,GAAG,CACrB,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,KAC5B,IAAI,CAAC;AAEV,eAAO,MAAM,sBAAsB,SAAU,MAAM,KAAG,eAUrD,CAAC;AAGF,eAAO,MAAM,gBAAgB,WAAY,GAAG,KAAG,KA+C9C,CAAC;AAGF,eAAO,MAAM,cAAc,UAAW,GAAG,KAAG,SAAS,GAAG,EAAE,GAAG,MAS5D,CAAC;AAEF,UAAU,EAAE;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,134 @@
1
+ /* eslint-disable no-continue */
2
+ /* eslint-disable no-unused-vars */
3
+ /* eslint-disable no-param-reassign */
4
+ /* eslint-disable no-prototype-builtins */
5
+ var __values = (this && this.__values) || function(o) {
6
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
7
+ if (m) return m.call(o);
8
+ if (o && typeof o.length === "number") return {
9
+ next: function () {
10
+ if (o && i >= o.length) o = void 0;
11
+ return { value: o && o[i++], done: !o };
12
+ }
13
+ };
14
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
15
+ };
16
+ var errorClasses = {};
17
+ var deserializers = {};
18
+ export var addCustomErrorDeserializer = function (name, deserializer) {
19
+ deserializers[name] = deserializer;
20
+ };
21
+ export var createCustomErrorClass = function (name) {
22
+ var C = function CustomError(message, fields) {
23
+ Object.assign(this, fields);
24
+ this.name = name;
25
+ this.message = message || name;
26
+ this.stack = new Error().stack;
27
+ };
28
+ C.prototype = new Error();
29
+ errorClasses[name] = C;
30
+ return C;
31
+ };
32
+ // inspired from https://github.com/programble/errio/blob/master/index.js
33
+ export var deserializeError = function (object) {
34
+ if (typeof object === "object" && object) {
35
+ try {
36
+ // $FlowFixMe FIXME HACK
37
+ var msg = JSON.parse(object.message);
38
+ if (msg.message && msg.name) {
39
+ object = msg;
40
+ }
41
+ }
42
+ catch (e) {
43
+ // nothing
44
+ }
45
+ var error = void 0;
46
+ if (typeof object.name === "string") {
47
+ var name_1 = object.name;
48
+ var des = deserializers[name_1];
49
+ if (des) {
50
+ error = des(object);
51
+ }
52
+ else {
53
+ var constructor = name_1 === "Error" ? Error : errorClasses[name_1];
54
+ if (!constructor) {
55
+ console.warn("deserializing an unknown class '" + name_1 + "'");
56
+ constructor = createCustomErrorClass(name_1);
57
+ }
58
+ error = Object.create(constructor.prototype);
59
+ try {
60
+ for (var prop in object) {
61
+ if (object.hasOwnProperty(prop)) {
62
+ error[prop] = object[prop];
63
+ }
64
+ }
65
+ }
66
+ catch (e) {
67
+ // sometimes setting a property can fail (e.g. .name)
68
+ }
69
+ }
70
+ }
71
+ else {
72
+ error = new Error(object.message);
73
+ }
74
+ if (!error.stack && Error.captureStackTrace) {
75
+ Error.captureStackTrace(error, deserializeError);
76
+ }
77
+ return error;
78
+ }
79
+ return new Error(String(object));
80
+ };
81
+ // inspired from https://github.com/sindresorhus/serialize-error/blob/master/index.js
82
+ export var serializeError = function (value) {
83
+ if (!value)
84
+ return value;
85
+ if (typeof value === "object") {
86
+ return destroyCircular(value, []);
87
+ }
88
+ if (typeof value === "function") {
89
+ return "[Function: ".concat(value.name || "anonymous", "]");
90
+ }
91
+ return value;
92
+ };
93
+ // https://www.npmjs.com/package/destroy-circular
94
+ function destroyCircular(from, seen) {
95
+ var e_1, _a;
96
+ var to = {};
97
+ seen.push(from);
98
+ try {
99
+ for (var _b = __values(Object.keys(from)), _c = _b.next(); !_c.done; _c = _b.next()) {
100
+ var key = _c.value;
101
+ var value = from[key];
102
+ if (typeof value === "function") {
103
+ continue;
104
+ }
105
+ if (!value || typeof value !== "object") {
106
+ to[key] = value;
107
+ continue;
108
+ }
109
+ if (seen.indexOf(from[key]) === -1) {
110
+ to[key] = destroyCircular(from[key], seen.slice(0));
111
+ continue;
112
+ }
113
+ to[key] = "[Circular]";
114
+ }
115
+ }
116
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
117
+ finally {
118
+ try {
119
+ if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
120
+ }
121
+ finally { if (e_1) throw e_1.error; }
122
+ }
123
+ if (typeof from.name === "string") {
124
+ to.name = from.name;
125
+ }
126
+ if (typeof from.message === "string") {
127
+ to.message = from.message;
128
+ }
129
+ if (typeof from.stack === "string") {
130
+ to.stack = from.stack;
131
+ }
132
+ return to;
133
+ }
134
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,mCAAmC;AACnC,sCAAsC;AACtC,0CAA0C;;;;;;;;;;;;AAE1C,IAAM,YAAY,GAAG,EAAE,CAAC;AACxB,IAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,CAAC,IAAM,0BAA0B,GAAG,UACxC,IAAY,EACZ,YAA+B;IAE/B,aAAa,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;AACrC,CAAC,CAAC;AAOF,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAC,IAAY;IACjD,IAAM,CAAC,GAAoB,SAAS,WAAW,CAAC,OAAO,EAAE,MAAM;QAC7D,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