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

Displays traceback/js errors in the browser #130

Open
berinhard opened this issue Nov 7, 2020 · 5 comments
Open

Displays traceback/js errors in the browser #130

berinhard opened this issue Nov 7, 2020 · 5 comments
Milestone

Comments

@berinhard
Copy link
Owner

Currently people have to keep an eye in their browser's console for both js errors (if using transcrypt) and python errors (if using pyodide).

The ideal scenario would be to have some type of HTML element displaying all error messages that pop up in the browser's console.

@villares
Copy link
Contributor

villares commented Mar 3, 2021

Hey @macarena, I bet you could add this single-handedly and with your eyes closed...

@Vamoss
Copy link

Vamoss commented Apr 17, 2021

[PT]
Uma abordagem a ser considerado é interceptar a função javascript e injetar codigo nela.
https://stackoverflow.com/questions/9216441/intercept-calls-to-console-log-in-chrome

Em um projeto que vi interceptando o log, observei uma perda de performance considerável. Então já recomendo uma maneira de renderização desses logs no HTML da forma mais simples possível, sem parser ou tratamentos que sejam custosos ;)

[EN]
One approach to be considered is to intercept the javascript function and inject code into it.
https://stackoverflow.com/questions/9216441/intercept-calls-to-console-log-in-chrome

In a project that I saw intercepting the log, I noticed a considerable loss of performance. So I already recommend a way of rendering these logs in HTML in the simplest possible way, without parser or treatments that are costly;)

@msawired
Copy link

Shining some light on this topic from OpenProcessing wisdom: Vamoss is correct that any interception and adding HTML elements to display errors and logs causes some performance drop, but it has its benefits as well. ie. user-friendliness etc. That's why I made it a user-preference option to toggle html console on/off.
Console overrides for console.log, console.warn, console.error... works pretty well. Catching and printing errors however is challenging, as some error events may have sandboxed elements that can not be passed outside the native browser console. For that, and as a general helper, I use stacktrace.js to extract the minimal necessary information, and show it to user on html console. I'd be happy to look into it when I start adding python to beta version on OP.

@berinhard
Copy link
Owner Author

I have a feeling that #189 will be a facilitator to this task. The idea to expose a JS entry point as a Promise, will enable the client code to handle the errors raised from the promise. I'm just leaving this note here as a personal reminder =)

@berinhard berinhard added this to the pyp5js 1.0.0 milestone Nov 2, 2021
@berinhard
Copy link
Owner Author

This should also be added to the demo editor

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

4 participants