UNPKG

@superfluid-finance/sdk-core

Version:
29 lines 851 B
"use strict"; /** * Credit of everything here goes to Redux Toolkit (RTK). */ Object.defineProperty(exports, "__esModule", { value: true }); exports.miniSerializeError = void 0; const commonProperties = [ "name", "code", "message", ]; /** * Serializes an error into a plain object. * Reworked from https://github.com/sindresorhus/serialize-error */ const miniSerializeError = (value) => { if (typeof value === "object" && value !== null) { const simpleError = {}; for (const property of commonProperties) { if (typeof value[property] === "string") { simpleError[property] = value[property]; } } return simpleError; } return { message: String(value) }; }; exports.miniSerializeError = miniSerializeError; //# sourceMappingURL=miniSerializeError.js.map