Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Change error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
abelgomez committed Mar 23, 2016
1 parent efb4a4c commit 86476e9
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Comparator;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Expand All @@ -27,6 +29,8 @@

public class CliLauncher {

private static final Logger LOGGER = Logger.getLogger(CliLauncher.class.getName());

private static final String PREFIX = "p";
private static final String PREFIX_LONG = "prefix";
private static final String INPUT = "i";
Expand All @@ -47,7 +51,11 @@ public class CliLauncher {
public static void main(String[] args) {
try {
run(args);
} catch (Exception e) {
} catch (Throwable t) {
if (t instanceof RuntimeException || t instanceof Error) {
// Log unexpected unchecked exception
LOGGER.log(Level.SEVERE, t.toString(), t);
}
System.exit(ReturnCodes.ERROR.getReturnCode());
}
}
Expand Down

0 comments on commit 86476e9

Please sign in to comment.