Download node_modules/axios/lib/core/enhanceError.js from khoadang31/uptimerobot: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/khoadang31/uptimerobot/resolve/main/node_modules/axios/lib/core/enhanceError.js
- Command line
-
hf download hf://khoadang31/uptimerobot/node_modules/axios/lib/core/enhanceError.js
-
curl -L -o enhanceError.js https://huggingface.co/khoadang31/uptimerobot/resolve/main/node_modules/axios/lib/core/enhanceError.js
1.13 kB
| ; | |
| /** | |
| * Update an Error with the specified config, error code, and response. | |
| * | |
| * @param {Error} error The error to update. | |
| * @param {Object} config The config. | |
| * @param {string} [code] The error code (for example, 'ECONNABORTED'). | |
| * @param {Object} [request] The request. | |
| * @param {Object} [response] The response. | |
| * @returns {Error} The error. | |
| */ | |
| module.exports = function enhanceError(error, config, code, request, response) { | |
| error.config = config; | |
| if (code) { | |
| error.code = code; | |
| } | |
| error.request = request; | |
| error.response = response; | |
| error.isAxiosError = true; | |
| error.toJSON = function toJSON() { | |
| return { | |
| // Standard | |
| message: this.message, | |
| name: this.name, | |
| // Microsoft | |
| description: this.description, | |
| number: this.number, | |
| // Mozilla | |
| fileName: this.fileName, | |
| lineNumber: this.lineNumber, | |
| columnNumber: this.columnNumber, | |
| stack: this.stack, | |
| // Axios | |
| config: this.config, | |
| code: this.code, | |
| status: this.response && this.response.status ? this.response.status : null | |
| }; | |
| }; | |
| return error; | |
| }; | |