public ExceptionHandler(APIException ex)
{
// API Exceptions can be nested. Hence we will need to recurse the
// exception hierarchy to dig for a conclusive message
Response response = ex.getResponse();
// Print the stack trace to standard out for debugging purposes
ex.printStackTrace();
// The API failed to execute the command (i.e. a real API error)
if( null == response)
{
message = ex.getMessage();
command = new java.lang.String();
//exitCode = Integer.parseInt(ex.getExceptionId());
exitCode = -1;
}
else
{
command = response.getCommandString();
try
{
exitCode = response.getExitCode();
}
catch(InterruptedException ie)
{
// Just print out the stack trace
ie.printStackTrace();
exitCode = -1;
}
WorkItemIterator wit = response.getWorkItems();
// In the event there is a problem with one of the command's elements
// we have to dig deeper into the exception...
try
{
while(wit.hasNext()){ wit.next(); }