2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

Improve timeout error when timeout is browser default (#3209)

I seems like the browser imposes a default timeout despite the documented default timeout being "never".  When this timeout occurs, axios confusingly reports an error "timeout of 0ms exceeded".  This change the message to avoid the confusing "0ms" part.

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Dobes Vandermeer
2021-09-16 12:16:43 -07:00
committed by GitHub
parent e52cd3ac64
commit 96956e30ba
+1 -1
View File
@@ -104,7 +104,7 @@ module.exports = function xhrAdapter(config) {
// Handle timeout
request.ontimeout = function handleTimeout() {
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
if (config.timeoutErrorMessage) {
timeoutErrorMessage = config.timeoutErrorMessage;
}