File tree Expand file tree Collapse file tree 3 files changed +112
-190
lines changed Expand file tree Collapse file tree 3 files changed +112
-190
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ Code will be on the `master` branch.
56
56
- [x] migrate src/watch.ts and its tests to fetch api from request
57
57
- [x] remove decprecated requestImpl and RequestInterface
58
58
- [x] implement queryParams parameter in watch method by injecting them into the fetch call
59
- - [ ] update tests in src/watch_test.ts
59
+ - [x ] update tests in src/watch_test.ts
60
60
- [ ] Fix errors in test (due to new api)
61
61
- [ ] Test all features
62
62
- [ ] Fix examples and validate their param signatures (due to new api)
Original file line number Diff line number Diff line change @@ -68,7 +68,16 @@ export class Watch {
68
68
69
69
await fetch ( watchURL , requestInit )
70
70
. then ( ( response ) => {
71
- response . body . pipe ( stream ) ;
71
+ if ( response . status === 200 ) {
72
+ response . body . on ( 'error' , doneCallOnce ) ;
73
+ response . body . pipe ( stream ) ;
74
+ } else {
75
+ const error = new Error ( response . statusText ) as Error & {
76
+ statusCode : number | undefined ;
77
+ } ;
78
+ error . statusCode = response . status ;
79
+ throw error ;
80
+ }
72
81
} )
73
82
. catch ( doneCallOnce ) ;
74
83
You can’t perform that action at this time.
0 commit comments