json-type-cli
Version:
High-performance JSON Pointer implementation
16 lines (15 loc) • 585 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatError = void 0;
const Value_1 = require("@jsonjoy.com/json-type/lib/value/Value");
const caller_1 = require("@jsonjoy.com/reactive-rpc/lib/common/rpc/caller");
const formatError = (err) => {
if (err instanceof Value_1.Value)
return (0, exports.formatError)(err.data);
if (err instanceof caller_1.RpcError)
return err.toJson();
if (err instanceof Error)
return { message: err.message, stack: err.stack };
return err;
};
exports.formatError = formatError;