{"id":23397551,"url":"https://github.com/leocode/better-axios-error","last_synced_at":"2025-07-22T10:06:46.203Z","repository":{"id":45427711,"uuid":"316505670","full_name":"leocode/better-axios-error","owner":"leocode","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-14T13:47:58.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-08T18:21:25.432Z","etag":null,"topics":["axios","errors","stacktrace"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leocode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-27T13:14:53.000Z","updated_at":"2021-12-14T15:35:27.000Z","dependencies_parsed_at":"2022-08-04T15:00:14.517Z","dependency_job_id":null,"html_url":"https://github.com/leocode/better-axios-error","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leocode/better-axios-error","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocode%2Fbetter-axios-error","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocode%2Fbetter-axios-error/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocode%2Fbetter-axios-error/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocode%2Fbetter-axios-error/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leocode","download_url":"https://codeload.github.com/leocode/better-axios-error/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocode%2Fbetter-axios-error/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266473028,"owners_count":23934475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axios","errors","stacktrace"],"created_at":"2024-12-22T08:19:12.214Z","updated_at":"2025-07-22T10:06:46.174Z","avatar_url":"https://github.com/leocode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# better-axios-errors\n\nEnhance your axios errors in a simple way\n\nTypical axios error looks like this:\n\n```\nError: Request failed with status code 404\n  at createError (/home/leocode/Leocode/better-axios-error/node_modules/axios/lib/core/createError.js:16:15)\n  at settle (/home/leocode/Leocode/better-axios-error/node_modules/axios/lib/core/settle.js:17:12)\n  at IncomingMessage.handleStreamEnd (/home/leocode/Leocode/better-axios-error/node_modules/axios/lib/adapters/http.js:244:11)\n  at IncomingMessage.emit (events.js:327:22)\n  at endReadableNT (internal/streams/readable.js:1327:12)\n  at processTicksAndRejections (internal/process/task_queues.js:80:21)\n```\n\nWithout any useful information about where in the code the error happened.\n\nAfter adding simple\n\n```\nconst axios = enhanceAxios(Axios.create())\n```\n\nCalling axios with errors results in\n\n```\nError: Request failed with status code 404\n    at createError (/home/leocode/Leocode/better-axios-error/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/home/leocode/Leocode/better-axios-error/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/home/leocode/Leocode/better-axios-error/node_modules/axios/lib/adapters/http.js:244:11)\n    at IncomingMessage.emit (events.js:327:22)\n    at endReadableNT (internal/streams/readable.js:1327:12)\n    at processTicksAndRejections (internal/process/task_queues.js:80:21)\nThrown at:\n    at async hahaNobodyWillSeeMe (/home/leocode/Leocode/better-axios-error/tests/test.js:6:3)\n    at async /home/leocode/Leocode/better-axios-error/tests/test.js:16:3\n```\n\nSo the stack trace of code that caused a problem is included, and we see that `hahaNobodyWillSeeMe` method was responsible!\n\n## Installation\n\n`yarn add @leocode/better-axios-errors axios`\n\nor\n\n`npm install --save @leocode/better-axios-errors axios`\n\n## Usage\n\nInstead of importing axios directly from library,\ncreate a file, that will export enhanced one!\n\n```js\nimport axios from 'axios';\nimport { enhanceAxios } from '@leocode/better-axios-errors';\n\nexport const enhancedAxios = enhanceAxios(axios.create());\n```\n\nNow you can use `enhancedAxios` as normal axios instance.\n\nAlso, if you want to import enhanced axios instance, you can do it directly:\n\n```js\nimport { axios } from '@leocode/better-axios-errors';\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocode%2Fbetter-axios-error","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleocode%2Fbetter-axios-error","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocode%2Fbetter-axios-error/lists"}