use of org.eclipse.ceylon.common.tool.ModelException in project ceylon by eclipse.
the class CeylonTool method handleException.
public static int handleException(CeylonTool mainTool, Exception ex) throws Exception {
int result;
if (ex instanceof NoSuchToolException) {
result = SC_NO_SUCH_TOOL;
} else if (ex instanceof ModelException) {
result = SC_TOOL_CREATION;
} else if (ex instanceof OptionArgumentException) {
result = SC_ARGS;
} else if (ex instanceof FatalToolError) {
result = SC_TOOL_BUG;
} else if (ex instanceof ToolError) {
ToolError err = (ToolError) ex;
result = err.isExitCodeProvided() ? err.getExitCode() : SC_TOOL_ERROR;
} else {
result = SC_TOOL_EXCEPTION;
}
Usage.handleException(mainTool, mainTool.getToolName(), ex);
return result;
}
Aggregations