Skip to main content

SequenceAnnotationGenerator catches exception and displays message

Comments

3 comments

  • Official comment
    Tom Edwards

    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

  • Pamela Russell

    Thanks, this is what I was looking for! Is there a way to disable the button that displays the stack trace?

    0
  • Tom Edwards

    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.