Skip to content

Commit 875c675

Browse files
committedOct 29, 2020
typescript client: added HTTP status code check
1 parent 33253a6 commit 875c675

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎otohttp/templates/client.ts.plush

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export class Client {
3535
headers: headers,
3636
body: JSON.stringify(<%= camelize_down(method.InputObject.TypeName) %>),
3737
})
38+
if (response.status !== 200) {
39+
throw new Error(`<%= service.Name %>.<%= method.Name %>: ${response.status} ${response.statusText}`);
40+
}
3841
return response.json().then((json) => {
3942
if (json.error) {
4043
throw new Error(json.error);

0 commit comments

Comments
 (0)
Please sign in to comment.