@activepieces/pieces-common
Advanced tools
Comparing version 0.2.28 to 0.2.29
{ | ||
"name": "@activepieces/pieces-common", | ||
"version": "0.2.28", | ||
"version": "0.2.29", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
import { AxiosError } from 'axios'; | ||
export declare class HttpError extends Error { | ||
private readonly _requestBody; | ||
private readonly _err; | ||
constructor(_requestBody: unknown, _err: AxiosError); | ||
private readonly requestBody; | ||
private readonly status; | ||
private readonly responseBody; | ||
constructor(requestBody: unknown, err: AxiosError); | ||
errorMessage(): { | ||
@@ -7,0 +8,0 @@ response: { |
@@ -5,25 +5,27 @@ "use strict"; | ||
class HttpError extends Error { | ||
constructor(_requestBody, _err) { | ||
constructor(requestBody, err) { | ||
var _a, _b; | ||
const status = ((_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.status) || 500; | ||
const responseBody = (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data; | ||
super(JSON.stringify({ | ||
response: { | ||
status: ((_a = _err === null || _err === void 0 ? void 0 : _err.response) === null || _a === void 0 ? void 0 : _a.status) || 500, | ||
body: (_b = _err === null || _err === void 0 ? void 0 : _err.response) === null || _b === void 0 ? void 0 : _b.data, | ||
status: status, | ||
body: responseBody, | ||
}, | ||
request: { | ||
body: _requestBody, | ||
body: requestBody, | ||
}, | ||
})); | ||
this._requestBody = _requestBody; | ||
this._err = _err; | ||
this.requestBody = requestBody; | ||
this.status = status; | ||
this.responseBody = responseBody; | ||
} | ||
errorMessage() { | ||
var _a, _b, _c, _d; | ||
return { | ||
response: { | ||
status: ((_b = (_a = this._err) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.status) || 500, | ||
body: (_d = (_c = this._err) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.data, | ||
status: this.status, | ||
body: this.responseBody, | ||
}, | ||
request: { | ||
body: this._requestBody, | ||
body: this.requestBody, | ||
}, | ||
@@ -33,6 +35,5 @@ }; | ||
get response() { | ||
var _a, _b, _c, _d; | ||
return { | ||
status: ((_b = (_a = this._err) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.status) || 500, | ||
body: (_d = (_c = this._err) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.data, | ||
status: this.status, | ||
body: this.responseBody, | ||
}; | ||
@@ -42,3 +43,3 @@ } | ||
return { | ||
body: this._requestBody, | ||
body: this.requestBody, | ||
}; | ||
@@ -45,0 +46,0 @@ } |
Sorry, the diff of this file is not supported yet
1761
117093