public static void handleException(Project project, Exception e) throws RuntimeException {
        LOG.info(e);

        if (e instanceof GenerateCodeException) {
            // code generation error - display velocity error in error dialog so user can identify problem quicker
          Messages.showMessageDialog(project,
                                     JavaBundle.message("generate.tostring.handle.exception.velocity.error.message", e.getMessage()),
                                     CommonBundle.message("title.warning"), Messages.getWarningIcon());
        }
        else if (e instanceof PluginException) {
            // plugin related error - could be recoverable.
            Messages.showMessageDialog(project, JavaBundle
              .message("generate.tostring.handle.exception.plugin.warning.message", e.getMessage()), CommonBundle.message("title.warning"), Messages.getWarningIcon());
        }
        else {
          // unknown error (such as NPE) - not recoverable
          Messages.showMessageDialog(project, JavaBundle.message("generate.tostring.handle.exception.error.message", e.getMessage()),
                                     CommonBundle.getErrorTitle(), Messages.getErrorIcon());
          if (e instanceof RuntimeException) {
            throw (RuntimeException) e; // throw to make IDEA alert user
          } else {
            // unknown error (such as NPE) - not recoverable
            throw new RuntimeException(e); // rethrow as runtime to make IDEA alert user
          }
        }
    }
public static void handleException(Project project, Exception e)