/** * Exit if klass has the same type or sub-type as throwable or one of its causes. If exiting, emit * message. */ private static void exitIfThrowableMatches( Throwable throwable, Class klass, Errno errno, String message) { Throwable cause = Throwables2.getFirstThrowableOfType(throwable, klass); if (cause == null) { return; } System.err.format("%s: %s\n", message, cause.getMessage()); System.exit(errno.getErrno()); }