Skip to content

Commit 91e3f57

Browse files
Mohit TejaniMohit Tejani
authored andcommitted
exclude 404 from retryable
1 parent f166eba commit 91e3f57

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/transport/middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class PubNubMiddleware {
125125
activeCancellation = attemptCancellation;
126126
const responseHandler = (res, error) => {
127127
const retriableError = error ? error.category !== categories_1.default.PNCancelledCategory : true;
128-
const retriableStatusCode = !res || res.status >= 400;
128+
const retriableStatusCode = (!res || res.status >= 400) && (error === null || error === void 0 ? void 0 : error.statusCode) !== 404;
129129
let delay = -1;
130130
if (retriableError &&
131131
retriableStatusCode &&

src/transport/middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class PubNubMiddleware implements Transport {
173173

174174
const responseHandler = (res?: TransportResponse, error?: PubNubAPIError) => {
175175
const retriableError = error ? error.category !== StatusCategory.PNCancelledCategory : true;
176-
const retriableStatusCode = !res || res.status >= 400;
176+
const retriableStatusCode = (!res || res.status >= 400) && error?.statusCode!== 404;
177177
let delay = -1;
178178

179179
if (

0 commit comments

Comments
 (0)