Search in sources :

Example 1 with ConnectorStartFailedException

use of org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException in project nzbhydra2 by theotherp.

the class NzbHydra method handleException.

private static void handleException(Exception e) throws Exception {
    String msg;
    if (e.getClass().getName().contains("SilentExitException")) {
        // Sometimes thrown by spring boot devtools
        return;
    }
    if (e instanceof YAMLException) {
        msg = "The file " + new File(dataFolder, "nzbhydra.yml").getAbsolutePath() + " could not be parsed properly. It might be corrupted. Try restoring it from a backup. Error message: " + e.getMessage();
        logger.error(msg);
    }
    if (e instanceof ConnectorStartFailedException) {
        msg = "The selected port is already in use. Either shut the other application down or select another port";
        logger.error(msg);
    } else {
        msg = "An unexpected error occurred during startup: " + e;
        logger.error("An unexpected error occurred during startup", e);
    }
    try {
        if (!GraphicsEnvironment.isHeadless() && isOsWindows()) {
            JOptionPane.showMessageDialog(null, msg, "NZBHydra 2 error", JOptionPane.ERROR_MESSAGE);
        }
    } catch (HeadlessException e1) {
        logger.warn("Unable to show exception in message dialog: {}", e1.getMessage());
    }
    // Rethrow so that spring exception handlers can handle this
    throw e;
}
Also used : YAMLException(org.yaml.snakeyaml.error.YAMLException) File(java.io.File) ConnectorStartFailedException(org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException)

Aggregations

File (java.io.File)1 ConnectorStartFailedException (org.springframework.boot.context.embedded.tomcat.ConnectorStartFailedException)1 YAMLException (org.yaml.snakeyaml.error.YAMLException)1