Ruben Laguna’s blog

Eclipse Error Reporting: Exception Stacktrace Details

I’m working with Eclipse 3.2.2 RCP right now and I’m getting an exception that I want to display on screen. I found in the eclipsepedia that we must use ErrorDialog to report errors:

try {
// ...
} catch (InvocationTargetException e) {
  IStatus status = new Status(IStatus.ERROR, Application.ID, 1, "Exception found.", e.getCause());
  ErrorDialog.openError(window.getShell(),"Error while loading file", null,status);						

But using this code snippet will only print the e.getLocalizedMessage() in the Details pane of the ErrorDialog. See screenshot


If you want to see the full stacktrace of the exception in the Details pane you have to implement your own ErrorDialog. Thus taking ErrorDialog as a base and modifiying it a little bit with the guidance found here I created

Using ExceptionDetailsErrorDialog instead of ErrorDialog shows the following dialog: