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 88  IOPacket , 
99  parsePacket , 
1010}  from  "../utils/ioSerialization.js" ; 
11+ import  {  ApiError  }  from  "./errors.js" ; 
1112import  {  ApiClient  }  from  "./index.js" ; 
1213import  {  AsyncIterableStream ,  createAsyncIterableStream ,  zodShapeStream  }  from  "./stream.js" ; 
1314import  {  EventSourceParserStream  }  from  "eventsource-parser/stream" ; 
@@ -119,6 +120,15 @@ export class SSEStreamSubscription implements StreamSubscription {
119120      } , 
120121      signal : this . options . signal , 
121122    } ) . 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+ 
122132      if  ( ! response . body )  { 
123133        throw  new  Error ( "No response body" ) ; 
124134      } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments