Skip to content

Commit d29da33

Browse files
authored
return promise so errors bubble (#4)
1 parent b329008 commit d29da33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/fetch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function fetchImpl(url, { method, headers, body, onNext, onError, onCompl
1313
const reader = response.body.getReader();
1414
const textDecoder = new TextDecoder();
1515
const patchResolver = new PatchResolver({ onResponse: r => onNext(r) });
16-
reader.read().then(function sendNext({ value, done }) {
16+
return reader.read().then(function sendNext({ value, done }) {
1717
if (!done) {
1818
let plaintext;
1919
try {
@@ -33,7 +33,7 @@ export function fetchImpl(url, { method, headers, body, onNext, onError, onCompl
3333
}
3434
});
3535
} else {
36-
response.json().then(json => {
36+
return response.json().then(json => {
3737
onNext(json);
3838
onComplete();
3939
});

0 commit comments

Comments
 (0)