@belgattitude/http-exception
Version:
Warning: has been moved to @httpx/exception. Please update.
41 lines (37 loc) • 1.39 kB
JavaScript
import { inherits as _inherits, createClass as _createClass, wrapNativeSuper as _wrapNativeSuper, assertThisInitialized as _assertThisInitialized } from '../_virtual/_rollupPluginBabelHelpers.js';
import { getSuper } from '../utils/getSuper.js';
import { supportsErrorCause } from '../support/supportsErrorCause.js';
var HttpException = function (_Error) {
_inherits(HttpException, _Error);
function HttpException(statusCode, msgOrParams) {
var _this;
var name = 'HttpException';
var _getSuper = getSuper(name, msgOrParams),
message = _getSuper.message,
url = _getSuper.url,
cause = _getSuper.cause,
errorId = _getSuper.errorId,
code = _getSuper.code,
method = _getSuper.method;
_this = _Error.call(this, message) || this;
_this.statusCode = void 0;
_this.url = void 0;
_this.method = void 0;
_this.code = void 0;
_this.errorId = void 0;
_this.cause = void 0;
if (supportsErrorCause() && cause instanceof Error) {
_this.cause = cause;
}
_this.statusCode = statusCode;
_this.url = url;
_this.errorId = errorId;
_this.code = code;
_this.method = method;
Object.setPrototypeOf(_assertThisInitialized(_this), HttpException.prototype);
_this.name = name;
return _this;
}
return _createClass(HttpException);
}(_wrapNativeSuper(Error));
export { HttpException };