Describe the bug
Describe the improvement The Axios documentation does not include a
clear example showing how to handle request timeouts using async/await
syntax.
Current behavior Timeout configuration is documented, but there is no
example demonstrating how to properly catch timeout errors using
async/await.
Expected improvement Add a simple example to the documentation, such as:
try {
const response = await axios.get('/api/data', { timeout: 2000 });
console.log(response.data);
} catch (error) {
if (error.code === 'ECONNABORTED') {
console.error('Request timed out');
} else {
console.error(error);
}
}
Why this matters Handling request timeouts is a common use case,
especially in slow networks. A clear example would improve developer
experience and reduce confusion for beginners.
Environment N/A
Additional context Happy to submit a PR adding this example if
maintainers approve.
To Reproduce
No response
Code snippet
Expected behavior
No response
Axios Version
No response
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
Additional context/Screenshots
Describe the bug
Describe the improvement The Axios documentation does not include a
clear example showing how to handle request timeouts using async/await
syntax.
Current behavior Timeout configuration is documented, but there is no
example demonstrating how to properly catch timeout errors using
async/await.
Expected improvement Add a simple example to the documentation, such as:
Why this matters Handling request timeouts is a common use case,
especially in slow networks. A clear example would improve developer
experience and reduce confusion for beginners.
Environment N/A
Additional context Happy to submit a PR adding this example if
maintainers approve.
To Reproduce
No response
Code snippet
Expected behavior
No response
Axios Version
No response
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
Additional context/Screenshots