File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/core/src/v3/apiClient Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 8
8
IOPacket ,
9
9
parsePacket ,
10
10
} from "../utils/ioSerialization.js" ;
11
+ import { ApiError } from "./errors.js" ;
11
12
import { ApiClient } from "./index.js" ;
12
13
import { AsyncIterableStream , createAsyncIterableStream , zodShapeStream } from "./stream.js" ;
13
14
import { EventSourceParserStream } from "eventsource-parser/stream" ;
@@ -119,6 +120,15 @@ export class SSEStreamSubscription implements StreamSubscription {
119
120
} ,
120
121
signal : this . options . signal ,
121
122
} ) . then ( ( response ) => {
123
+ if ( ! response . ok ) {
124
+ throw ApiError . generate (
125
+ response . status ,
126
+ { } ,
127
+ "Could not subscribe to stream" ,
128
+ Object . fromEntries ( response . headers )
129
+ ) ;
130
+ }
131
+
122
132
if ( ! response . body ) {
123
133
throw new Error ( "No response body" ) ;
124
134
}
You can’t perform that action at this time.
0 commit comments