• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.errCode = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2'use strict';
3
4function assign(obj, props) {
5    for (const key in props) {
6        Object.defineProperty(obj, key, {
7            value: props[key],
8            enumerable: true,
9            configurable: true,
10        });
11    }
12
13    return obj;
14}
15
16function createError(err, code, props) {
17    if (!err || typeof err === 'string') {
18        throw new TypeError('Please pass an Error to err-code');
19    }
20
21    if (!props) {
22        props = {};
23    }
24
25    if (typeof code === 'object') {
26        props = code;
27        code = undefined;
28    }
29
30    if (code != null) {
31        props.code = code;
32    }
33
34    try {
35        return assign(err, props);
36    } catch (_) {
37        props.message = err.message;
38        props.stack = err.stack;
39
40        const ErrClass = function () {};
41
42        ErrClass.prototype = Object.create(Object.getPrototypeOf(err));
43
44        return assign(new ErrClass(), props);
45    }
46}
47
48module.exports = createError;
49
50},{}]},{},[1])(1)
51});
52