use of org.graylog2.plugin.system.NodeIdPersistenceException 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);
}
}
}
}
Aggregations