-
Notifications
You must be signed in to change notification settings - Fork 34
Catch syntax errors in custom visualisations #1341
Conversation
Syntax errors in custom visualisations caused panics during IDE startup. Now they are caught and handled like errors during execution of the visualisation code, which writes a log message to the console. This commit duplicates some code from wasm-bindgen to to allow for an easy fix. Hopefully the necessary feature will be included in wasm-bindgen soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this. We can merge it now. Would you be so nice and open also PR in the wasm-bindgen repo and link the PR in this function.rs
doc comment that you've created, please?
Please ask someone from the team to test it as well before the merge, I cant handle it right now.
...ide/view/graph-editor/src/component/visualization/foreign/java_script/definition/function.rs
Outdated
Show resolved
Hide resolved
...ide/view/graph-editor/src/component/visualization/foreign/java_script/definition/function.rs
Outdated
Show resolved
Hide resolved
Also, before merging this, please test this on the issue that Maciek had: https://github.com/enso-org/ide/issues/1310 The issue was NOT about panic - it was about hanging gui on startup, while still you were able to drag nodes etc. Just test it fixes this thing. @BinarySoftware please test it too. |
I created the PR at wasm-bindgen. And yes, this solves the original issue. |
Catch syntax errors in custom visualisations Syntax errors in custom visualisations caused panics during IDE startup. Now they are caught and handled like errors during execution of the visualisation code, which writes a log message to the console. This commit duplicates some code from wasm-bindgen to to allow for an easy fix. Hopefully the necessary feature will be included in wasm-bindgen soon. Original commit: enso-org/ide@2d04d0e
Pull Request Description
This is a potential solution to #1310.
Syntax errors in custom visualisations caused panics during IDE startup. Now they are caught and handled like errors during execution of the visualisation code, which means that we write a log message to the console.
Important Notes
The wasm-bindgen API that we used to parse visualisation code from JS, does not allow to handle syntax errors, it always panics on those. I filed an issue at their GitHub repo, suggesting that they allow error handling. As a temporary fix, this PR includes a copy of their relevant code with the necessary changes. We could merge this now or wait to see if they react to the issue and provide the possibility for a cleaner solution.
With this PR, syntax errors in visualisations will only be logged to the console, which means that they stay invisible to normal users. In the long term, they should be reported on the GUI.
Checklist
Please include the following checklist in your PR:
CHANGELOG.md
was updated with the changes introduced in this PR.