Lack of structured error categorization for "Network Error" reduces debugging clarity
When using Axios, different underlying network failures (such as no internet connection, DNS resolution failure, CORS blockage, or server unavailability) are all represented as a single generic error message: "Network Error".
While I understand this behavior originates from browser-level security restrictions (XMLHttpRequest / Fetch API), from a developer experience perspective, it becomes difficult to identify the exact cause of failure during debugging.
Steps to Observe: Make an Axios request to a valid endpoint Simulate different failure scenarios:
- Disable internet connection
- Use an invalid domain
- Trigger a CORS policy block
- Block request using firewall/network restrictions
Observed Behavior: Axios returns the same error message: "Network Error"
Expected Behavior: While respecting browser security limitations, Axios could provide a more structured error object or error classification, for example:
- error.code: NO_INTERNET
- error.code: DNS_FAILURE
- error.code: CORS_BLOCKED
- error.code: NETWORK_UNREACHABLE
Impact: This lack of categorization makes debugging slower and increases difficulty in identifying root causes, especially for new developers.
Additional Context: This is understood to be a limitation of browser security design, but Axios could potentially improve developer experience by adding abstraction or classification logic.
Found while interning at iCreativez Technologies
Source: axios/axios