@cardano-sdk/util
Advanced tools
Comparing version 0.14.3 to 0.14.4
@@ -13,2 +13,4 @@ "use strict"; | ||
const defaultTransformationTypeKey = '__type'; | ||
const hasInnerError = (error) => error !== null && typeof error === 'object' && 'innerError' in error; | ||
const innerErrorHasData = (innerError) => typeof innerError === 'object' && innerError !== null && 'data' in innerError; | ||
const toSerializableObject = (obj, options = {}) => { | ||
@@ -35,2 +37,5 @@ if (PLAIN_TYPES.has(typeof obj)) | ||
if (obj instanceof Error) { | ||
if (hasInnerError(obj) && innerErrorHasData(obj.innerError)) { | ||
obj.innerError.data = (0, exports.toSerializableObject)(obj.innerError.data); | ||
} | ||
return { | ||
@@ -37,0 +42,0 @@ [transformationTypeKey]: 'Error', |
@@ -7,2 +7,4 @@ import { serializeError } from 'serialize-error'; | ||
const defaultTransformationTypeKey = '__type'; | ||
const hasInnerError = (error) => error !== null && typeof error === 'object' && 'innerError' in error; | ||
const innerErrorHasData = (innerError) => typeof innerError === 'object' && innerError !== null && 'data' in innerError; | ||
export const toSerializableObject = (obj, options = {}) => { | ||
@@ -29,2 +31,5 @@ if (PLAIN_TYPES.has(typeof obj)) | ||
if (obj instanceof Error) { | ||
if (hasInnerError(obj) && innerErrorHasData(obj.innerError)) { | ||
obj.innerError.data = toSerializableObject(obj.innerError.data); | ||
} | ||
return { | ||
@@ -31,0 +36,0 @@ [transformationTypeKey]: 'Error', |
{ | ||
"name": "@cardano-sdk/util", | ||
"version": "0.14.3", | ||
"version": "0.14.4", | ||
"description": "General, not cardano-specific utils", | ||
@@ -64,3 +64,3 @@ "engines": { | ||
], | ||
"gitHead": "02a0eff7b7b7a3b98b42fd19b2ae85cfc4e7d87f" | ||
"gitHead": "8a6db2a251cd1c956f52730a0d35de2b7fc67404" | ||
} |
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
416988
1620