Skip to content

Commit

Permalink
custom timeout prompt copy (#2275)
Browse files Browse the repository at this point in the history
* style: ui

* feat: custom timeout txtx

* feat: custom timeout txtx
  • Loading branch information
IVLIU authored and felipewmartins committed Oct 16, 2019
1 parent ccca5e0 commit 6284abf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.d.ts
Expand Up @@ -49,6 +49,7 @@ export interface AxiosRequestConfig {
paramsSerializer?: (params: any) => string;
data?: any;
timeout?: number;
timeoutErrorMessage?: string;
withCredentials?: boolean;
adapter?: AxiosAdapter;
auth?: AxiosBasicCredentials;
Expand Down
6 changes: 5 additions & 1 deletion lib/adapters/xhr.js
Expand Up @@ -88,7 +88,11 @@ module.exports = function xhrAdapter(config) {

// Handle timeout
request.ontimeout = function handleTimeout() {
reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED',
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
if (config.timeoutErrorMessage) {
timeoutErrorMessage = config.timeoutErrorMessage;
}
reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
request));

// Clean up request
Expand Down

0 comments on commit 6284abf

Please sign in to comment.