Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue #94 raise from exceptions #105

Merged

Conversation

alongadot
Copy link

Suggestion In order to resolve issue #94

this PR uses the raise from idiom in order to wrap caught exceptions with additional context while preserving their original stack traces.

Notes

The original issue required the exception in semantic-router/semantic_router/llms/openai.py be re-raised, but this PR addresses similar occurrences of this pattern while preserving the additional context added by the new raised exceptions.

@jamescalam
Copy link
Member

Looks good, thanks @alongadot — will run tests

@jamescalam jamescalam changed the title raise from exceptions rather than new exceptions to preserve stack trace fix: raise from exceptions rather than new exceptions to preserve stack trace Jan 15, 2024
Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (779072b) 91.24% compared to head (d8319a6) 91.24%.

Files Patch % Lines
semantic_router/encoders/fastembed.py 0.00% 1 Missing ⚠️
semantic_router/llms/openai.py 50.00% 1 Missing ⚠️
semantic_router/llms/openrouter.py 50.00% 1 Missing ⚠️
semantic_router/utils/llm.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #105   +/-   ##
=======================================
  Coverage   91.24%   91.24%           
=======================================
  Files          25       25           
  Lines        1085     1085           
=======================================
  Hits          990      990           
  Misses         95       95           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alongadot alongadot force-pushed the issue-94/reraise-exceptions-w-trace branch from 30c843b to 9881ea6 Compare January 16, 2024 07:56
@alongadot
Copy link
Author

I've corrected the linting issue regarding using Conventional Commits format in the commit message. The build also failed due to a failure in uploading the Codecov report, do you have any advice on that?

@jamescalam
Copy link
Member

@alongadot conventional commits doesn't like the length of your commit message — could you shorten it? For Codecov that's on us, I'm looking into it

@alongadot alongadot force-pushed the issue-94/reraise-exceptions-w-trace branch from 9881ea6 to 18ec60a Compare January 16, 2024 11:17
@alongadot alongadot changed the title fix: raise from exceptions rather than new exceptions to preserve stack trace fix: issue #94 raise from exceptions Jan 17, 2024
@alongadot
Copy link
Author

I see codecov/patch failed - should I add test coverage, given no new statements were actually added?

@jamescalam
Copy link
Member

@alongadot codecov can be difficult 😅 — we have it as optional so I am merging and we'll add coverage for those statements in the future, thanks for the PR!

@jamescalam jamescalam merged commit a5cfa03 into aurelio-labs:main Jan 17, 2024
6 of 8 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