dialogos-project / dialogos

The DialogOS dialog system.
https://www.dialogos.app
GNU General Public License v3.0
21 stars 8 forks source link

"Show node" button does not work #117

Open alexanderkoller opened 6 years ago

alexanderkoller commented 6 years ago

If an exception occurs inside a node while executing a dialog graph, DialogOS shows a window that displays the exception message and offers to focus on the node with a button labeled "Show Node". Clicking on "Show Node" closes the window, but does not focus the node.

The attached dialog illustrates this.

illegal-script.dos.zip

alexanderkoller commented 6 years ago

To be honest, I don't understand why this would have ever worked.

The top-level function call that eventually triggers the execute methods of the Nodes is

ExecutionResult r = doc.run(SingleDocumentWindow.this, SingleDocumentWindow.this.runtime);

in SingleDocumentWindow. Exceptions that are thrown in the execute method of a Node are caught inside this run method, and are then returned as part of the ExecutionResult.

If the getNode() method of the ExecutionResult is non-null, the error dialog is displayed using OptionPane.showOptionDialog. Weirdly, this method returns immediately, with a return value of -1, so it can never trigger the code below "if(result==1)", which would focus the offending node.

I think this needs to be changed such that the error dialog is modal, so that the call to setVisible only returns once the dialog is closed. While we're at it, we should also add a "Details" button, like in OptionPane.createOptionPane, so the user can look at the complete stacktrace and send it to us.

This seems like a major operation, and I'm taking the issue out of the milestone.