Skip to content

Improve exception handing in langchain_tools.py#6149

Merged
suhaibmujahid merged 1 commit into
mozilla:masterfrom
padenot:better-exceptions-searchfox
Jun 12, 2026
Merged

Improve exception handing in langchain_tools.py#6149
suhaibmujahid merged 1 commit into
mozilla:masterfrom
padenot:better-exceptions-searchfox

Conversation

@padenot

@padenot padenot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

The searchfox-lib python bindings weren't using typed exceptions, but this got added in 0.16.

This changes the following:

  • If the tool call fails because of a logic error (file not found, using wrong arguments, etc.), we log with error level, this goes to sentry. We want to track those and improve API/documentation/etc. -- this is generally actionnable
  • If the tool call fails because of a searchfox infra error (network, load, timeout etc.), we allow ourselve to retry, but if that still fails it is logged as a warning -- we can't do much.

@padenot padenot force-pushed the better-exceptions-searchfox branch from c404501 to 986ca33 Compare June 11, 2026 14:47
The searchfox-lib python bindings weren't using typed exceptions, but
this got added in 0.16.

This changes the following:
- If the tool call fails because of a logic error (file not found, using
  wrong arguments, etc.), we log with error level, this goes to sentry.
  We want to track those and improve API/documentation/etc. -- this is
  generally actionnable
- If the tool call fails because of a searchfox infra error (network,
  load, timeout etc.), we allow ourselve to retry, but if that still
  fails it is logged as a warning -- we can't do much.
@padenot padenot force-pushed the better-exceptions-searchfox branch from 986ca33 to cefd162 Compare June 11, 2026 14:59
@padenot padenot requested a review from suhaibmujahid June 11, 2026 16:46

@suhaibmujahid suhaibmujahid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thank you!

@suhaibmujahid suhaibmujahid merged commit 015fa46 into mozilla:master Jun 12, 2026
6 checks passed
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.

2 participants