UNPKG

@bscotch/stitch

Version:

Stitch: The GameMaker Studio 2 Asset Pipeline Development Kit.

30 lines 1.01 kB
// import { prettifyErrorTracing, replaceFilePaths } from '@bscotch/validation'; // prettifyErrorTracing({ replaceFilePaths }); export class StitchError extends Error { constructor(message, asserter) { super(message); this.name = 'StitchError'; Error.captureStackTrace(this, asserter || this.constructor); } } export class StitchAssertionError extends Error { constructor(message, asserter) { super(message); this.name = 'StitchAssertionError'; Error.captureStackTrace(this, asserter || this.constructor); } } export function assert(claim, message) { if (!claim) { throw new StitchAssertionError(message || 'Claim is falsey', assert); } } export function isNumber(value) { return typeof value == 'number'; } export function assertIsNumber(claim, message) { if (!isNumber(claim)) { throw new StitchAssertionError(message || `${claim} is not a number`, assertIsNumber); } } //# sourceMappingURL=errors.js.map