@cardano-sdk/util
Advanced tools
Comparing version 0.8.3-nightly.1 to 0.9.0-nightly.0
import { CustomError } from 'ts-custom-error'; | ||
export declare const formatErrorMessage: (reason: string, detail?: string) => string; | ||
export declare const stripStackTrace: (error: unknown) => void; | ||
export declare class ComposableError<InnerError = unknown> extends CustomError { | ||
@@ -4,0 +5,0 @@ innerError?: InnerError | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InvalidArgumentError = exports.InvalidStringError = exports.ComposableError = exports.formatErrorMessage = void 0; | ||
exports.InvalidArgumentError = exports.InvalidStringError = exports.ComposableError = exports.stripStackTrace = exports.formatErrorMessage = void 0; | ||
const ts_custom_error_1 = require("ts-custom-error"); | ||
const formatErrorMessage = (reason, detail) => reason + (detail ? ` (${detail})` : ''); | ||
exports.formatErrorMessage = formatErrorMessage; | ||
const isWithInnerError = (error) => error !== null && typeof error === 'object' && 'innerError' in error; | ||
const isErrorLike = (error) => { | ||
@@ -13,2 +14,13 @@ if (!error || typeof error !== 'object' || !('message' in error && 'stack' in error)) | ||
}; | ||
const stripStackTrace = (error) => { | ||
if (!error) | ||
return; | ||
if (isErrorLike(error)) { | ||
delete error.stack; | ||
} | ||
if (isWithInnerError(error)) { | ||
(0, exports.stripStackTrace)(error.innerError); | ||
} | ||
}; | ||
exports.stripStackTrace = stripStackTrace; | ||
class ComposableError extends ts_custom_error_1.CustomError { | ||
@@ -15,0 +27,0 @@ constructor(message, innerError) { |
@@ -15,2 +15,4 @@ export * from './equals'; | ||
export * from './opaqueTypes'; | ||
export * from './environment'; | ||
export { PromiseOrValue, resolveObjectValues } from './util'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,2 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveObjectValues = void 0; | ||
__exportStar(require("./equals"), exports); | ||
@@ -32,2 +33,5 @@ __exportStar(require("./errors"), exports); | ||
__exportStar(require("./opaqueTypes"), exports); | ||
__exportStar(require("./environment"), exports); | ||
var util_1 = require("./util"); | ||
Object.defineProperty(exports, "resolveObjectValues", { enumerable: true, get: function () { return util_1.resolveObjectValues; } }); | ||
//# sourceMappingURL=index.js.map |
import { CustomError } from 'ts-custom-error'; | ||
export declare const formatErrorMessage: (reason: string, detail?: string) => string; | ||
export declare const stripStackTrace: (error: unknown) => void; | ||
export declare class ComposableError<InnerError = unknown> extends CustomError { | ||
@@ -4,0 +5,0 @@ innerError?: InnerError | undefined; |
import { CustomError } from 'ts-custom-error'; | ||
export const formatErrorMessage = (reason, detail) => reason + (detail ? ` (${detail})` : ''); | ||
const isWithInnerError = (error) => error !== null && typeof error === 'object' && 'innerError' in error; | ||
const isErrorLike = (error) => { | ||
@@ -9,2 +10,12 @@ if (!error || typeof error !== 'object' || !('message' in error && 'stack' in error)) | ||
}; | ||
export const stripStackTrace = (error) => { | ||
if (!error) | ||
return; | ||
if (isErrorLike(error)) { | ||
delete error.stack; | ||
} | ||
if (isWithInnerError(error)) { | ||
stripStackTrace(error.innerError); | ||
} | ||
}; | ||
export class ComposableError extends CustomError { | ||
@@ -11,0 +22,0 @@ constructor(message, innerError) { |
@@ -15,2 +15,4 @@ export * from './equals'; | ||
export * from './opaqueTypes'; | ||
export * from './environment'; | ||
export { PromiseOrValue, resolveObjectValues } from './util'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,2 +15,4 @@ export * from './equals'; | ||
export * from './opaqueTypes'; | ||
export * from './environment'; | ||
export { resolveObjectValues } from './util'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@cardano-sdk/util", | ||
"version": "0.8.3-nightly.1", | ||
"version": "0.9.0-nightly.0", | ||
"description": "General, not cardano-specific utils", | ||
@@ -56,3 +56,3 @@ "engines": { | ||
"devDependencies": { | ||
"@cardano-sdk/util-dev": "^0.8.1-nightly.2", | ||
"@cardano-sdk/util-dev": "^0.8.1-nightly.3", | ||
"@types/lodash": "^4.14.182", | ||
@@ -81,3 +81,3 @@ "eslint": "^7.32.0", | ||
], | ||
"gitHead": "43319ac7bf111b0d8ef541b2f7d75ff436a7e48b" | ||
"gitHead": "973854d70b06e7c9e64fd8edf52cee970d6eb85f" | ||
} |
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
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
376028
144
1294