UNPKG

@baqhub/sdk

Version:

The official JavaScript SDK for the BAQ federated app platform.

21 lines (20 loc) 563 B
/** Custom class to use when sub-classing Error. */ export 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); } } export class ErrorWithData extends CustomError { data; constructor(message, data) { super(message); this.data = data; } } export function never() { throw new Error("This should never happen."); }