Skip to content

Commit

Permalink
make afterware errors bubble up
Browse files Browse the repository at this point in the history
  • Loading branch information
edvinerikson committed Dec 2, 2016
1 parent b2d9a7c commit 8779f20
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/transport/networkInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,11 @@ export class HTTPFetchNetworkInterface implements NetworkInterface {
request,
options,
}).then(this.fetchFromRemoteEndpoint.bind(this))
.then(response => {
this.applyAfterwares({
response: response as IResponse,
options,
});
return response;
})
.then(result => (result as IResponse).json())
.then(response => this.applyAfterwares({
response: response as IResponse,
options,
}))
.then(({ response }) => (response as IResponse).json())
.then((payload: GraphQLResult) => {
if (!payload.hasOwnProperty('data') && !payload.hasOwnProperty('errors')) {
throw new Error(
Expand Down

0 comments on commit 8779f20

Please sign in to comment.