@fmal/http-service
Version:
A HTTP service - orignally @cerebral/http
42 lines (34 loc) • 965 B
JavaScript
import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
import _wrapNativeSuper from "@babel/runtime/helpers/esm/wrapNativeSuper";
var HttpServiceError =
/*#__PURE__*/
function (_Error) {
_inheritsLoose(HttpServiceError, _Error);
function HttpServiceError(type, status, headers, result, message) {
var _this;
if (message === void 0) {
message = null;
}
_this = _Error.call(this, message) || this;
_this.name = 'HttpServiceError';
_this.type = type || 'http';
_this.response = {
status: status,
headers: headers,
result: result
};
return _this;
}
var _proto = HttpServiceError.prototype;
_proto.toJSON = function toJSON() {
return {
type: this.type,
name: this.name,
message: this.message,
response: this.response,
stack: this.stack
};
};
return HttpServiceError;
}(_wrapNativeSuper(Error));
export { HttpServiceError as default };