Skip to content

Commit

Permalink
feat: status codes that should not be retried
Browse files Browse the repository at this point in the history
  • Loading branch information
kukhariev committed May 27, 2019
1 parent 9f1b5a9 commit 196e191
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/uploadx/src/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { unfunc, noop } from './utils';
* Uploader Base Class
*/
export abstract class Uploader {
/**
* HTTP StatusCodes should not be retried
*/
static fatalStatusCodes = [403];
/**
* Max 4xx errors
*/
Expand Down Expand Up @@ -44,7 +48,10 @@ export abstract class Uploader {
}

private get isMaxAttemptsReached(): boolean {
return this.retry.retryAttempts === Uploader.maxRetryAttempts && this.statusType === 400;
return (
this.responseStatus in Uploader.fatalStatusCodes ||
(this.retry.retryAttempts === Uploader.maxRetryAttempts && this.statusType === 400)
);
}

/**
Expand Down

0 comments on commit 196e191

Please sign in to comment.