in runner/src/main/java/org/jclouds/cli/runner/Main.java [117:154]
public static void main(String args[]) throws Exception {
Main main = new Main();
try {
main.run(args);
} catch (CommandNotFoundException cnfe) {
String str = Ansi.ansi()
.fg(Ansi.Color.RED)
.a("Command not found: ")
.a(Ansi.Attribute.INTENSITY_BOLD)
.a(cnfe.getCommand())
.a(Ansi.Attribute.INTENSITY_BOLD_OFF)
.fg(Ansi.Color.DEFAULT).toString();
System.err.println(str);
System.exit(Errno.UNKNOWN.getErrno());
} catch (CommandException ce) {
System.err.println(ce.getNiceHelp());
System.exit(Errno.UNKNOWN.getErrno());
} catch (Throwable t) {
exitIfThrowableMatches(t, AuthorizationException.class, Errno.EACCES, "Authorization error");
exitIfThrowableMatches(t, ContainerNotFoundException.class, Errno.ENOENT, "Container not found");
// FileNotFoundException must precede IOException due to inheritance
exitIfThrowableMatches(t, FileNotFoundException.class, Errno.ENOENT, "File not found");
// UnknownHostException must precede IOException due to inheritance
exitIfThrowableMatches(t, UnknownHostException.class, Errno.ENXIO, "Unknown host");
exitIfThrowableMatches(t, IOException.class, Errno.EIO, "IO error");
exitIfThrowableMatches(t, InsufficientResourcesException.class, Errno.EDQUOT, "Insufficient resources");
exitIfThrowableMatches(t, KeyNotFoundException.class, Errno.ENOENT, "Blob not found");
exitIfThrowableMatches(t, ResourceAlreadyExistsException.class, Errno.EEXIST, "Resource already exists");
// ContainerNotFoundException and KeyNotFoundException must precede ResourceNotFoundException due to inheritance
exitIfThrowableMatches(t, ResourceNotFoundException.class, Errno.ENOENT, "Resource not found");
exitIfThrowableMatches(t, TimeoutException.class, Errno.ETIMEDOUT, "Timeout");
t.printStackTrace();
System.exit(Errno.UNKNOWN.getErrno());
}
// We must explicitly exit on success since we do not close
// BlobStoreContext and ComputeServiceContext.
System.exit(0);
}