@tapjs/error-serdes
Version:
Port of node's error_serdes.js to userland, plus test message streaming
28 lines • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.kSerializedSizeHeader = exports.kV8HeaderLength = exports.errorCtorNames = exports.errors = exports.kCustomInspect = exports.kCustomInspectedObject = exports.kInspectedSymbol = exports.kInspectedError = exports.kSerializedObject = exports.kSerializedError = void 0;
const node_v8_1 = require("node:v8");
exports.kSerializedError = 0;
exports.kSerializedObject = 1;
exports.kInspectedError = 2;
exports.kInspectedSymbol = 3;
exports.kCustomInspectedObject = 4;
exports.kCustomInspect = Symbol.for('nodejs.util.inspect.custom');
exports.errors = {
Error,
TypeError,
RangeError,
URIError,
SyntaxError,
ReferenceError,
EvalError,
};
exports.errorCtorNames = new Set(Object.keys(exports.errors));
// get the header length that v8 uses
const serializer = new node_v8_1.DefaultSerializer();
serializer.writeHeader();
const v8Header = serializer.releaseBuffer();
exports.kV8HeaderLength = v8Header.length;
// add space for the Uint32 message size
exports.kSerializedSizeHeader = 4 + exports.kV8HeaderLength;
//# sourceMappingURL=constants.js.map