8000 Improve timeout error when timeout is browser default (#3209) · darth-coder-js/axios@96956e3 · GitHub
[go: up one dir, main page]

Skip to content
forked from axios/axios

Commit 96956e3

Browse files
dobesvjasonsaayman
andauthored
Improve timeout error when timeout is browser default (axios#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>
1 parent e52cd3a commit 96956e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/adapters/xhr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ module.exports = function xhrAdapter(config) {
104104

105105
// Handle timeout
106106
request.ontimeout = function handleTimeout() {
107-
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
107+
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
108108
if (config.timeoutErrorMessage) {
109109
timeoutErrorMessage = config.timeoutErrorMessage;
110110
}

0 commit comments

Comments
 (0)
0