Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Catch syntax errors in custom visualisations #1341

Merged
merged 4 commits into from
Mar 18, 2021

Conversation

s9ferech
Copy link
Contributor

@s9ferech s9ferech commented Mar 17, 2021

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:

  • The CHANGELOG.md was updated with the changes introduced in this PR.
  • The documentation has been updated if necessary.
  • All code conforms to the Rust style guide.
  • All code has automatic tests where possible.
  • All code has been profiled where possible.
  • All code has been manually tested in the IDE.
  • All code has been manually tested in the "debug/interface" scene.
  • All code has been manually tested by the PR owner against our test scenarios.
  • All code has been manually tested by at least one reviewer against our test scenarios.

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.
@s9ferech s9ferech self-assigned this Mar 17, 2021
@s9ferech s9ferech added Category: GUI The Graphical User Interface Priority: High Should be scheduled as soon as possible Type: Bug A bug in Enso IDE labels Mar 17, 2021
@s9ferech s9ferech requested a review from wdanilo March 17, 2021 13:27
Copy link
Member

@wdanilo wdanilo left a 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.

@wdanilo
Copy link
Member

wdanilo commented Mar 17, 2021

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.

@s9ferech
Copy link
Contributor Author

I created the PR at wasm-bindgen. And yes, this solves the original issue.

@s9ferech s9ferech marked this pull request as ready for review March 17, 2021 17:12
@s9ferech s9ferech merged commit 2d04d0e into develop Mar 18, 2021
@s9ferech s9ferech deleted the wip/fr/visualisation-errors branch March 22, 2021 21:46
mwu-tow pushed a commit to enso-org/enso that referenced this pull request Oct 30, 2021
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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Category: GUI The Graphical User Interface Priority: High Should be scheduled as soon as possible Type: Bug A bug in Enso IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants