fix stream errors

This commit is contained in:
Michael Yang 2023-07-20 12:12:08 -07:00
parent 00aaa05901
commit 1f27d7f1b8
3 changed files with 13 additions and 15 deletions

View file

@ -131,6 +131,10 @@ func (c *Client) stream(ctx context.Context, method, path string, data any, fn f
return fmt.Errorf("unmarshal: %w", err)
}
if errorResponse.Error != "" {
return fmt.Errorf("stream: %s", errorResponse.Error)
}
if response.StatusCode >= 400 {
return StatusError{
StatusCode: response.StatusCode,