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 #63: display traceback for exceptions in callables #64

Conversation

qwenger
Copy link
Collaborator

@qwenger qwenger commented Oct 22, 2021

Simple attempt for #63 . PyErr_WriteUnraisable seems to fit the bill quite well with minimal work.

Test:

>>> import quickjs
>>> def test():
...     1/0
... 
>>> ctx = quickjs.Context()
>>> ctx.add_callable("test", test)
>>> ctx.eval("test()")
Exception ignored in: <function test at 0x7efe29521940>
Traceback (most recent call last):
  File "<stdin>", line 2, in test
ZeroDivisionError: division by zero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_quickjs.JSException: InternalError: Python call failed.
    at test (native)
    at <eval> (<input>)

@qwenger
Copy link
Collaborator Author

qwenger commented Oct 27, 2021

Closing in favor of #67.

@qwenger qwenger closed this Oct 27, 2021
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.

1 participant