SequenceAnnotationGenerator catches exception and displays message
Hi,
I would like a general way to have a `SequenceAnnotationGenerator` catch an exception, display its message to the user in a dialog, then terminate without returning any annotations, returning the user to the sequence viewer to try again.
What is the recommended way to do this?
Thanks,
Pam
-
Official comment
Hi Pam,
The usual way we would do this is by throwing a DocumentOperationException from within methods. DocumentOperationExceptions are automatically shown as friendly dialog boxes by the GUI. So for example, if you wanted to catch absolutely any exception which your code throws and display it as a friendly dialog you could do something like this:
try {
...
// Code which may generate errors
...
} catch (Exception e) {
throw new DocumentOperationException(e.getMessage(), e);
}If you have any further questions, just let us know.
Cheers,
Tom -
Thanks, this is what I was looking for! Is there a way to disable the button that displays the stack trace?
0 -
Unfortunately not.
You could try using the Dialogs class, something like:
Dialogs.showMessageDialog("Hello!");
But this would mean you need to manually terminate as it's not an exception.
0
Please sign in to leave a comment.
Comments
3 comments