UNPKG

@etsoo/shared

Version:

TypeScript shared utilities and functions

23 lines (22 loc) 607 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DataError = void 0; /** * Error with custom data * Other information can be hold by 'name', 'cause', and 'stack' property * */ class DataError extends Error { /** * Constructor * @param message Error message * @param data Custom data */ constructor(message, data) { super(message); this.data = data; // Set the prototype explicitly to ensure instanceof works correctly Object.setPrototypeOf(this, DataError.prototype); } } exports.DataError = DataError;