UNPKG

spike-core

Version:

an opinionated static build tool, powered by webpack

33 lines (30 loc) 835 B
/** * @module Errors */ /** * @class SpikeError * @classdesc A spike-specific error class, echoes the underlying error but * with an added id, if provided. * @param {Object} args - error arguments object * @param {Number} args.id - error id * @param {String} args.message - the error message */ class SpikeError extends Error { constructor (args) { super(args.err) this.id = args.id this.message = args.err.message this.stack = args.err.stack if (!this.message) this.raw = args.err } } exports.Error = SpikeError /** * @class SpikeWarning * @classdesc A spike-specific warning class * @param {Object} args - error arguments object * @param {Number} args.id - error id * @param {String} args.message - the error message */ class SpikeWarning extends SpikeError {} exports.Warning = SpikeWarning