@superfluid-finance/sdk-core
Version:
SDK Core for building with Superfluid Protocol
25 lines • 695 B
JavaScript
/**
* Credit of everything here goes to Redux Toolkit (RTK).
*/
const commonProperties = [
"name",
"code",
"message",
];
/**
* Serializes an error into a plain object.
* Reworked from https://github.com/sindresorhus/serialize-error
*/
export 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) };
};
//# sourceMappingURL=miniSerializeError.js.map