private PicoUtils() {
}
- static Throwable sanitize(RuntimeException t) {
+ public static Throwable sanitize(Throwable t) {
Throwable result = t;
Throwable cause = t.getCause();
if (t instanceof PicoLifecycleException && cause != null) {
return result;
}
- public static void propagateStartupException(RuntimeException t) {
+ public static void propagateStartupException(Throwable t) {
throw Throwables.propagate(sanitize(t));
}
}
} catch (RuntimeException e) {
// full stacktrace is lost by jruby. It must be logged now.
- LoggerFactory.getLogger(getClass()).error(e.getMessage(), e);
- PicoUtils.propagateStartupException(e);
+ Throwable initialException = PicoUtils.sanitize(e);
+ LoggerFactory.getLogger(getClass()).error(initialException.getMessage(), initialException);
+ PicoUtils.propagateStartupException(initialException);
}
}
}
profiler.stop();
} catch (RuntimeException e) {
// full stacktrace is lost by jruby. It must be logged now.
- LoggerFactory.getLogger(getClass()).error(e.getMessage(), e);
- PicoUtils.propagateStartupException(e);
+ Throwable initialException = PicoUtils.sanitize(e);
+ LoggerFactory.getLogger(getClass()).error(initialException.getMessage(), initialException);
+ PicoUtils.propagateStartupException(initialException);
}
}
}