Skip to content

Commit

Permalink
fix(base): improve correctness of error check
Browse files Browse the repository at this point in the history
Co-authored-by: Espen Hovlandsdal <espen@hovlandsdal.com>
  • Loading branch information
bjoerge and rexxars committed Sep 14, 2022
1 parent 67a83cc commit 58d8bce
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ export const createObservableBufferedDocument = (
const {resultRev, ...mutation} = opts.mutation.params
commitMutations(mutation).then(opts.success, (error) => {
const isBadRequest =
error.name === 'ClientError' && error.statusCode >= 400 && error.statusCode <= 500
'statusCode' in error &&
typeof error.statusCode === 'number' &&
error.statusCode >= 400 &&
error.statusCode <= 500
if (isBadRequest) {
opts.cancel(error)
} else {
Expand Down

0 comments on commit 58d8bce

Please sign in to comment.