Skip to content

Conversation

@manucorporat
Copy link

…ageStream to handle parse errors

  • Introduced UnableToParseToolParameterError for better error handling.
  • Updated BetaMessageStream to conditionally ignore tool parameter parse errors based on new ignore_tool_parameter_parse_errors flag in MessageCreateParamsBase.
  • Enhanced error handling during JSON parsing in BetaMessageStream.

…ageStream to handle parse errors

- Introduced UnableToParseToolParameterError for better error handling.
- Updated BetaMessageStream to conditionally ignore tool parameter parse errors based on new ignore_tool_parameter_parse_errors flag in MessageCreateParamsBase.
- Enhanced error handling during JSON parsing in BetaMessageStream.
@manucorporat manucorporat requested a review from a team as a code owner December 9, 2025 13:16
Copy link
Collaborator

@RobertCraigie RobertCraigie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should ship a ignore_tool_parameter_parse_errors parameter.

Instead it would be a much better API if the error callback handler could somehow tell the stream to keep going.

e.g. something like this

stream.on('error', (error) => {
  if (error instanceof UnableToParseToolParameterError) {
    return { continue: true };
  }
});

The separate UnableToParseToolParameterError error class is a good change 👍.

@manucorporat
Copy link
Author

i can make this change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants