UNPKG

verror-0

Version:

VError without dependencies on top of nodejs standart library

23 lines (22 loc) 793 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SError = void 0; const parse_args_js_1 = require("./parse-args.js"); const verror_js_1 = require("./verror.js"); /* * SError is like VError, but stricter about types. You cannot pass "null" or * "undefined" as string arguments to the formatter. Since SError is only a * different function, not really a different class, we don't set * SError.prototype.name. */ class SError extends verror_js_1.VError { constructor(...args) { const parsed = (0, parse_args_js_1.parseArgs)({ argv: args, strict: true }); parsed.options.name = parsed.options.name ?? 'SError'; super(parsed.options, '%s', parsed.shortmessage); } } exports.SError = SError;