Search in sources :

Example 1 with UnsupportedSearchException

use of org.graylog2.storage.UnsupportedSearchException in project graylog2-server by Graylog2.

the class CmdLineTool method annotateInjectorExceptions.

protected void annotateInjectorExceptions(Collection<Message> messages) {
    for (Message message : messages) {
        // noinspection ThrowableResultOfMethodCallIgnored
        final Throwable rootCause = ExceptionUtils.getRootCause(message.getCause());
        if (rootCause instanceof NodeIdPersistenceException) {
            LOG.error(UI.wallString("Unable to read or persist your NodeId file. This means your node id file (" + configuration.getNodeIdFile() + ") is not readable or writable by the current user. The following exception might give more information: " + message));
            System.exit(-1);
        } else if (rootCause instanceof AccessDeniedException) {
            LOG.error(UI.wallString("Unable to access file " + rootCause.getMessage()));
            System.exit(-2);
        } else if (rootCause instanceof UnsupportedSearchException) {
            final SearchVersion search = ((UnsupportedSearchException) rootCause).getSearchMajorVersion();
            LOG.error(UI.wallString("Unsupported search version: " + search, DocsHelper.PAGE_ES_VERSIONS.toString()));
            System.exit(-3);
        } else if (rootCause instanceof ElasticsearchProbeException) {
            LOG.error(UI.wallString(rootCause.getMessage(), DocsHelper.PAGE_ES_CONFIGURATION.toString()));
            System.exit(-4);
        } else {
            // other guice error, still print the raw messages
            // TODO this could potentially print duplicate messages depending on what a subclass does...
            LOG.error("Guice error (more detail on log level debug): {}", message.getMessage());
            if (rootCause != null) {
                LOG.debug("Stacktrace:", rootCause);
            }
        }
    }
}
Also used : ElasticsearchProbeException(org.graylog2.storage.versionprobe.ElasticsearchProbeException) AccessDeniedException(java.nio.file.AccessDeniedException) Message(com.google.inject.spi.Message) UnsupportedSearchException(org.graylog2.storage.UnsupportedSearchException) SearchVersion(org.graylog2.storage.SearchVersion) NodeIdPersistenceException(org.graylog2.plugin.system.NodeIdPersistenceException)

Aggregations

Message (com.google.inject.spi.Message)1 AccessDeniedException (java.nio.file.AccessDeniedException)1 NodeIdPersistenceException (org.graylog2.plugin.system.NodeIdPersistenceException)1 SearchVersion (org.graylog2.storage.SearchVersion)1 UnsupportedSearchException (org.graylog2.storage.UnsupportedSearchException)1 ElasticsearchProbeException (org.graylog2.storage.versionprobe.ElasticsearchProbeException)1