Skip to content

Commit 9763f93

Browse files
VT-9003: Moved interceptor clean up to finally block
1 parent e21a2da commit 9763f93

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/rest/axios.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,6 @@ export function Axios(config) {
262262
}
263263

264264
retryAxios(options).then(response => {
265-
// Clean up interceptors
266-
retrySetup.cleanup();
267-
268265
var exceptionClass = {
269266
400: Exceptions.InvalidRequestError,
270267
401: Exceptions.AuthenticationError,
@@ -296,9 +293,6 @@ export function Axios(config) {
296293
});
297294
})
298295
.catch(function (error) {
299-
// Clean up interceptors on error too
300-
retrySetup.cleanup();
301-
302296
if (error.response == undefined){
303297
return reject(error.stack );
304298
}
@@ -331,6 +325,10 @@ export function Axios(config) {
331325
}
332326
reject(error.stack + '\n' + JSON.stringify(error.response.data));
333327
})
328+
.finally(() => {
329+
// Clean up interceptors in all cases - success, error, or unexpected exception
330+
retrySetup.cleanup();
331+
})
334332
}
335333
else {
336334
axios(options).then(response => {

0 commit comments

Comments
 (0)