@paladen/errors
Advanced tools
Comparing version 1.0.9 to 1.0.12
@@ -6,8 +6,8 @@ export declare type BaseErrorProps = { | ||
}; | ||
export declare class BaseError extends Error { | ||
export declare class BaseError { | ||
isBaseError: boolean; | ||
name: string; | ||
message: string; | ||
message?: string; | ||
httpStatusCode?: number; | ||
fields?: string[]; | ||
name?: string; | ||
constructor(props?: BaseErrorProps); | ||
@@ -14,0 +14,0 @@ } |
@@ -11,175 +11,19 @@ 'use strict'; | ||
function _typeof2(obj) { | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof2 = function _typeof2(obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof2 = function _typeof2(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
var BaseError = function BaseError(props) { | ||
_classCallCheck(this, BaseError); | ||
return _typeof2(obj); | ||
} | ||
this.isBaseError = true; | ||
function _typeof(obj) { | ||
if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") { | ||
_typeof = function _typeof(obj) { | ||
return _typeof2(obj); | ||
}; | ||
} else { | ||
_typeof = function _typeof(obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj); | ||
}; | ||
if (props && props.message) { | ||
this.message = props.message; | ||
} | ||
return _typeof(obj); | ||
} | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
if (props && props.httpStatusCode) { | ||
this.httpStatusCode = props.httpStatusCode; | ||
} | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (_typeof(call) === "object" || typeof call === "function")) { | ||
return call; | ||
if (props && props.fields) { | ||
this.fields = props.fields; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _isNativeFunction(fn) { | ||
return Function.toString.call(fn).indexOf("[native code]") !== -1; | ||
} | ||
function isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
if (Reflect.construct.sham) return false; | ||
if (typeof Proxy === "function") return true; | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
function _construct(Parent, args, Class) { | ||
if (isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
} else { | ||
_construct = function _construct(Parent, args, Class) { | ||
var a = [null]; | ||
a.push.apply(a, args); | ||
var Constructor = Function.bind.apply(Parent, a); | ||
var instance = new Constructor(); | ||
if (Class) _setPrototypeOf(instance, Class.prototype); | ||
return instance; | ||
}; | ||
} | ||
return _construct.apply(null, arguments); | ||
} | ||
function _wrapNativeSuper(Class) { | ||
var _cache = typeof Map === "function" ? new Map() : undefined; | ||
_wrapNativeSuper = function _wrapNativeSuper(Class) { | ||
if (Class === null || !_isNativeFunction(Class)) return Class; | ||
if (typeof Class !== "function") { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
if (typeof _cache !== "undefined") { | ||
if (_cache.has(Class)) return _cache.get(Class); | ||
_cache.set(Class, Wrapper); | ||
} | ||
function Wrapper() { | ||
return _construct(Class, arguments, _getPrototypeOf(this).constructor); | ||
} | ||
Wrapper.prototype = Object.create(Class.prototype, { | ||
constructor: { | ||
value: Wrapper, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
return _setPrototypeOf(Wrapper, Class); | ||
}; | ||
return _wrapNativeSuper(Class); | ||
} | ||
var BaseError = /*#__PURE__*/function (_Error) { | ||
_inherits(BaseError, _Error); | ||
function BaseError(props) { | ||
var _this; | ||
_classCallCheck(this, BaseError); | ||
var trueProto = (this instanceof BaseError ? this.constructor : void 0).prototype; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(BaseError).call(this, "")); | ||
Object.setPrototypeOf(_assertThisInitialized(_this), trueProto); | ||
_this.isBaseError = true; | ||
if (props && props.message) { | ||
_this.message = props.message; | ||
} | ||
if (props && props.httpStatusCode) { | ||
_this.httpStatusCode = props.httpStatusCode; | ||
} | ||
if (props && props.fields) { | ||
_this.fields = props.fields; | ||
} | ||
return _this; | ||
} | ||
return BaseError; | ||
}( /*#__PURE__*/_wrapNativeSuper(Error)); | ||
}; | ||
var createErrorResponseArray = function createErrorResponseArray(errors) { | ||
@@ -186,0 +30,0 @@ return { |
{ | ||
"name": "@paladen/errors", | ||
"version": "1.0.9", | ||
"version": "1.0.12", | ||
"repository": "https://github.com/samstr/paladen", | ||
@@ -17,3 +17,3 @@ "main": "dist/index.js", | ||
}, | ||
"gitHead": "aa5e397f1afd58c812ac9002a9daa3c47eb607a4" | ||
"gitHead": "da2c9d7b4021465d7c677db3444b17f18b3b0602" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1948
58