Skip to content

feat: set python exception if an error happens in a js callback #83

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

Merged
merged 3 commits into from
Jun 24, 2025

Conversation

sigmaSd
Copy link
Contributor

@sigmaSd sigmaSd commented Apr 21, 2025

This changes errors like this

SystemError: <built-in method JSCallback:anonymous of NoneType object at 0x7f988b6f8bd0> returned NULL without setting an exception

To something more useful

RuntimeError: JS Callback Error: PythonError: Must be number, not str

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Apr 21, 2025

this last commit 0eed1e5 change

RuntimeError: JS Callback Error: PythonError: Must be number, not str

The above exception was the direct cause of the following exception:

SystemError: <built-in method JSCallback:anonymous of NoneType object at 0x7fc7e6cf8bd0> returned a result with an exception set

to just

RuntimeError: JS Callback Error: PythonError: Must be number, not str

I think the first one just have extra noise

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Jun 21, 2025

bump @DjDeveloperr @eliassjogreen

I keep running into this issue once in a while, would be great if you merge this and push a new release

@sigmaSd
Copy link
Contributor Author

sigmaSd commented Jun 21, 2025

Its also possible to print the error.stack when its available I dont know if it should be done by default or hidden behind maybe an env var, I just happen to need it for an issue and it was useful

@eliassjogreen eliassjogreen merged commit 8b06a60 into denosaurs:main Jun 24, 2025
5 checks passed
@sigmaSd
Copy link
Contributor Author

sigmaSd commented Jun 25, 2025

Thanks @eliassjogreen would be great if you also push a new version to jsr

@eliassjogreen
Copy link
Member

I'll do it tomorrow. Remind me if I forget 😅

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