@baqhub/sdk
Version:
The official JavaScript SDK for the BAQ federated app platform.
27 lines (26 loc) • 770 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrorWithData = exports.CustomError = void 0;
exports.never = never;
/** Custom class to use when sub-classing Error. */
class CustomError extends Error {
constructor(message) {
// "Error" breaks the prototype chain here.
super(message);
// Restore it.
const actualPrototype = new.target.prototype;
Object.setPrototypeOf(this, actualPrototype);
}
}
exports.CustomError = CustomError;
class ErrorWithData extends CustomError {
data;
constructor(message, data) {
super(message);
this.data = data;
}
}
exports.ErrorWithData = ErrorWithData;
function never() {
throw new Error("This should never happen.");
}