@onekeyfe/hd-shared
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -57,2 +57,3 @@ export interface IHardwareError { | ||
readonly BridgeNetworkError: 806; | ||
readonly BridgeTimeoutError: 807; | ||
}; | ||
@@ -62,3 +63,4 @@ export declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping; | ||
export declare const serializeError: (payload: any) => any; | ||
export declare const CreateErrorByMessage: (message: string) => HardwareError; | ||
export {}; | ||
//# sourceMappingURL=HardwareError.d.ts.map |
@@ -66,2 +66,3 @@ declare type Deferred<T, I = any, D = any> = { | ||
readonly BridgeNetworkError: 806; | ||
readonly BridgeTimeoutError: 807; | ||
}; | ||
@@ -71,2 +72,3 @@ declare const HardwareErrorCodeMessage: HardwareErrorCodeMessageMapping; | ||
declare const serializeError: (payload: any) => any; | ||
declare const CreateErrorByMessage: (message: string) => HardwareError; | ||
@@ -80,2 +82,3 @@ type HardwareError$1_IHardwareError = IHardwareError; | ||
declare const HardwareError$1_serializeError: typeof serializeError; | ||
declare const HardwareError$1_CreateErrorByMessage: typeof CreateErrorByMessage; | ||
declare namespace HardwareError$1 { | ||
@@ -89,2 +92,3 @@ export { | ||
HardwareError$1_serializeError as serializeError, | ||
HardwareError$1_CreateErrorByMessage as CreateErrorByMessage, | ||
}; | ||
@@ -125,2 +129,2 @@ } | ||
export { Deferred, HardwareError$1 as ERRORS, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, TypedError, createDeferred, enableLog, enableLogByPrefix, getLog, initLog, serializeError, setOutsideLogger }; | ||
export { CreateErrorByMessage, Deferred, HardwareError$1 as ERRORS, HardwareError, HardwareErrorCode, HardwareErrorCodeMessage, IHardwareError, TypedError, createDeferred, enableLog, enableLogByPrefix, getLog, initLog, serializeError, setOutsideLogger }; |
@@ -124,2 +124,3 @@ 'use strict'; | ||
BridgeNetworkError: 806, | ||
BridgeTimeoutError: 807, | ||
}; | ||
@@ -168,2 +169,3 @@ const HardwareErrorCodeMessage = { | ||
[HardwareErrorCode.BridgeNetworkError]: 'Bridge network error', | ||
[HardwareErrorCode.BridgeTimeoutError]: 'Bridge network timeout', | ||
}; | ||
@@ -185,2 +187,10 @@ const TypedError = (hardwareError, message) => { | ||
}; | ||
const CreateErrorByMessage = (message) => { | ||
for (const code of Object.values(HardwareErrorCode)) { | ||
if (HardwareErrorCodeMessage[code] === message) { | ||
return TypedError(code); | ||
} | ||
} | ||
return new HardwareError(message); | ||
}; | ||
@@ -193,3 +203,4 @@ var HardwareError$1 = /*#__PURE__*/Object.freeze({ | ||
TypedError: TypedError, | ||
serializeError: serializeError | ||
serializeError: serializeError, | ||
CreateErrorByMessage: CreateErrorByMessage | ||
}); | ||
@@ -297,2 +308,3 @@ | ||
exports.CreateErrorByMessage = CreateErrorByMessage; | ||
exports.ERRORS = HardwareError$1; | ||
@@ -299,0 +311,0 @@ exports.HardwareError = HardwareError; |
{ | ||
"name": "@onekeyfe/hd-shared", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "Hardware SDK's shared tool library", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "f69fd0696e38efbc838848fb361cb900043bb2ec" | ||
"gitHead": "216fee1795067013da0d68f4fc25f583509bb509" | ||
} |
@@ -211,2 +211,7 @@ export interface IHardwareError { | ||
BridgeNetworkError: 806, | ||
/** | ||
* Bridge network timeout | ||
*/ | ||
BridgeTimeoutError: 807, | ||
} as const; | ||
@@ -287,2 +292,3 @@ | ||
[HardwareErrorCode.BridgeNetworkError]: 'Bridge network error', | ||
[HardwareErrorCode.BridgeTimeoutError]: 'Bridge network timeout', | ||
} as const; | ||
@@ -306,1 +312,10 @@ | ||
}; | ||
export const CreateErrorByMessage = (message: string): HardwareError => { | ||
for (const code of Object.values(HardwareErrorCode)) { | ||
if (HardwareErrorCodeMessage[code] === message) { | ||
return TypedError(code); | ||
} | ||
} | ||
return new HardwareError(message); | ||
}; |
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
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
36918
951