-
Notifications
You must be signed in to change notification settings - Fork 323
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
Throwing an unhandled exception in Polyglot Java results in a null in the UI and no caught error message #5260
Comments
What exactly is the bug report? I see it is concerned with Visualizing
|
With the #5684 fixes I see following message being delivered to the IDE. Regardless of that, there is no error indication: I believe the real fix needs to be done on the IDE side. Somehow handle the |
It seems IDE ignores To display errors, we use information provided by |
The world of Enso errors is rich (compilation errors, values with warnings, errors and panics). The message above is result of a |
Yes, that's true. The reason is (not sure if still valid) that the diagnostics are text-oriented, giving us line number instead of node id. |
…tently (#5684) Creating two `findExceptionMessage` methods in `HostEnsoUtils` and in `VisualizationResult`. Why two? Because one of them is using `org.graalvm.polyglot` SDK as it runs in _"normal Java"_ mode. The other one is using Truffle API as it is running inside of partially evaluated instrument. There is a `FindExceptionMessageTest` to guarantee consistency between the two methods. It simulates some exceptions in Enso code and checks that both methods extract the same _"message"_ from the exception. The tests verifies hosted and well as Enso exceptions - however testing other polyglot languages is only possible in other modules - as such I created `PolyglotFindExceptionMessageTest` - but that one doesn't have access to Truffle API - e.g. it doesn't really check the consistency - just that a reasonable message is extracted from a JavaScript exception. # Important Notes This is not full fix of #5260 - something needs to be done on the IDE side, as the IDE seems to ignore the delivered JSON message - even if it contains properly extracted exception message.
#5684 only makes sure the |
Of course, we can display the message in status bar somewhere, but it will be still inferior UX from just having a concrete node colored. Is the latter impossible to implement in the engine? |
I don't think this should be assigned to me. As I wrote, the panics should be reported in values update payload, so we can display them on nodes. Displaying global execution problems deserves its own task and will be done after we implement messages for the user. However, it does not fix the problem reported by this issue: reporting things in executionStatus should not be a normal routine. @JaroslavTulach Please answer my question: isn't fixing the problem correctly (by sending Panic payload) impossible in the engine? |
CC @sylwiabr as she took over planning from Greg |
That would, in my opinion, be a great start, @farmaazon. Just use the information you have -
... I would report a feature request to improve the UX by changing the protocol API.
In any case, I'd like you to show/propose/demonstate the requeted API changes by modifying language server specification. I am not completely sure what "by sending Panic payload" means in terms of language server protocol... |
Not so fast, we don't have a way to display long messages to the user yet. It's part of #5201 - definitely not an hour of work.
I don't need to change API, because we already have an API for reporting panics. Citing the protocol specification:
If you don't send |
We don't need a full blown solution right now: would be enough to fix the most painful problem
OK. Thank you for the explanation and showing me the missing piece of the puzzle. |
This partial solution has serious drawbacks, I described in the PR. But even with the perfect implementation with all diagnostics displayed in a neat multiline notification will be inferior to have this exception reported as Panic, with nice node coloring and proper propagation through the graph (so the user will quickly find it if it's in a nested function). I've checked what we receive in IDE. First, I created such a graph, where a panic is indeed properly reported, even with the polyglot type (the message, however, is a bit of obscure for user not accustomed to java): The issue appears when I want to throw an exception instance: The only
As you see, no panic payload is reported, only panic type. Moreover, there are "pending" expressions which seem to be never computed (I did not receive any further So, the proper solution for this issue is fixing Panic sending (those never ending pending expressions also deserves fixing). |
Report `AbstractTruffleException` as a `Panic`. Fixes #5260.
Jaroslav Tulach reports a new STANDUP for yesterday (2023-03-06): Progress: - Report AbstractTruffleException as a Panic: merged #5794
Next Day: #5177 + Performance & stability |
This task is automatically imported from the old Task Issue Board and it was originally created by James Dunkerley.
Original issue is here.
Throwing a NPE within Java caused an error when command line:
Within the UI get no error message and the viz shows
null
. Error from Language Server shown below.Comments:
(James Dunkerley - Dec 20, 2022)
``` from Standard.Base import Panic polyglot java import java.lang.NullPointerException
main =
x = NullPointerException.new
Panic.throw x
built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --no-ir-caches --run ~/work/repos/enso/test-cases/thrownpe.enso
Execution finished with an error: null
at Panic.throw(Internal)
at thrownpe.main(thrownpe.enso:6:5-17)
The text was updated successfully, but these errors were encountered: