UNPKG

@ireceipt.pro/js

Version:

Create PDF files or images (JPG, PNG, WEBP) from your HTML template.

23 lines 824 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.handleError = void 0; const axios_1 = require("axios"); const handleError = (err) => { if (err instanceof axios_1.AxiosError) { try { const respText = err.response?.data?.toString(); const respJSON = respText ? JSON.parse(respText) : { message: `Unknown error with status code ${err.code}` }; return new Error(respJSON.message); } catch { return new Error(`Unknown error with status code ${err.code}`); } } if (err instanceof Error) return err; return new Error(err?.message || `Unknown error with status code ${err?.code}`); }; exports.handleError = handleError; //# sourceMappingURL=handleError.js.map