Skip to content

Commit 904bb7e

Browse files
authored
return statusCode on json parse error (#51)
1 parent fe82243 commit 904bb7e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/fetch.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ export function fetchImpl(url, { onNext, onComplete, onError, ...fetchOptions })
3939
return response.json().then((json) => {
4040
onNext([json], { responseHeaders: response.headers });
4141
onComplete();
42+
}, (err) => {
43+
const parseError = err;
44+
parseError.response = response;
45+
parseError.statusCode = response.status;
46+
onError(parseError);
4247
});
4348
}
4449
})

0 commit comments

Comments
 (0)