UNPKG

xero-node

Version:

Xero NodeJS OAuth 2.0 client for xero-node

34 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiError = void 0; class ApiError { constructor(axiosError) { var _a, _b; this.statusCode = axiosError.response.status; this.body = axiosError.response.data; this.headers = axiosError.response.headers; this.request = { url: { protocol: axiosError.request.protocol, port: ((_a = axiosError.request.agent) === null || _a === void 0 ? void 0 : _a.defaultPort) || ((_b = axiosError.request.socket) === null || _b === void 0 ? void 0 : _b.localPort), host: axiosError.request.host, path: axiosError.request.path, }, headers: axiosError.request.getHeaders(), method: axiosError.request.method }; } generateError() { return { response: { statusCode: this.statusCode, body: this.body, headers: this.headers, request: this.request, }, body: this.body }; } } exports.ApiError = ApiError; //# sourceMappingURL=ApiError.js.map