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

Handling execution errors in Output #289

Closed
sok82 opened this issue Aug 15, 2024 · 1 comment
Closed

Handling execution errors in Output #289

sok82 opened this issue Aug 15, 2024 · 1 comment

Comments

@sok82
Copy link
Contributor

sok82 commented Aug 15, 2024

I'm experimenting with version 0.17.0 having functionality of monitoring kernel phase introduced in #282

And I'm experiencing a problem when execution finishes with error

Kernel phase monitoring works fine when execution finishes successfully, but when something is wrong with a code exception is thrown from kernel execution promise and I don't have an idea of how to catch it.

The way I trigger execution is just by increasing executionTrigger for output, so I don't control promise implicitly...

Exception example is

Uncaught Error TypeError: bar() missing 1 required positional argument: 'height'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[12], line 1
----> 1 plt.bar(job_satisfaction_rate_train['job_satisfaction_rate'], color='green');

TypeError: bar() missing 1 required positional argument: 'height'
    at reject (/Users/sk/Develop/d20/d20-git-repo/d20-platform-wiki-editor-ui/node_modules/@lumino/coreutils/src/promise.ts:51:1)
    at _onReply (/Users/sk/Develop/src/jupyter/kernel/KernelExecutor.ts:262:1)
    at _handleReply (/Users/sk/Develop/d20/d20-git-repo/d20-platform-wiki-editor-ui/node_modules/@jupyterlab/services/src/kernel/future.ts:237:1)
    at handleMsg (/Users/sk/Develop/d20/d20-git-repo/d20-platform-wiki-editor-ui/node_modules/@jupyterlab/services/src/kernel/future.ts:219:1)
    at _handleMessage (/Users/sk/Develop/d20/d20-git-repo/d20-platform-wiki-editor-ui/node_modules/@jupyterlab/services/src/kernel/default.ts:1430:1)
    at <anonymous> (/Users/sk/Develop/d20/d20-git-repo/d20-platform-wiki-editor-ui/node_modules/@jupyterlab/services/src/kernel/default.ts:1595:1)
    --- Promise.then ---
    at KernelConnection._onWSMessage (/Users/sk/Develop/d20/d20-git-repo/d20-platform-wiki-editor-ui/node_modules/@jupyterlab/services/src/kernel/default.ts:1591:1)

Is there a chance to catch and process this exception?

What is a correct way of doing this?

In my case I just don't need this exception at all (because I have all the details in output which is enough), so for me it's better to suppress it (for example having some flag on output that will control suppression) in JS code and just pass exception description to output

@echarles
Copy link
Member

echarles commented Sep 9, 2024

jupyter-react 0.18.4 is released with this features.

Closing for now, please reopen if needed. Thx again.

@echarles echarles closed this as completed Sep 9, 2024
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

No branches or pull requests

2 participants