Skip to content

Commit 71828a5

Browse files
fix: correctly raise errors encountered during streaming
1 parent 9e5d91e commit 71828a5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/openai/internal/stream.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ class Stream
3838
else
3939
"An error occurred during streaming"
4040
end
41-
OpenAI::Errors::APIError.for(
41+
err = OpenAI::Errors::APIError.for(
4242
url: @url,
4343
status: @status,
44-
body: body,
44+
body: data,
4545
request: nil,
4646
response: @response,
4747
message: message
4848
)
49+
raise err
4950
in decoded
5051
unwrapped = OpenAI::Internal::Util.dig(decoded, @unwrap)
5152
y << OpenAI::Internal::Type::Converter.coerce(@model, unwrapped)

0 commit comments

Comments
 (0)