catch any throwable

This commit is contained in:
2024-04-02 19:29:36 -05:00
parent 6fb39899a6
commit 30b07e7f3a

View File

@ -169,17 +169,24 @@ public class AsyncJobManager
LOG.debug("Completed job " + uuidAndTypeStateKey.getUuid()); LOG.debug("Completed job " + uuidAndTypeStateKey.getUuid());
return (result); return (result);
} }
catch(Exception e) catch(Throwable t)
{ {
asyncJobStatus.setState(AsyncJobState.ERROR); asyncJobStatus.setState(AsyncJobState.ERROR);
asyncJobStatus.setCaughtException(e); if(t instanceof Exception e)
{
asyncJobStatus.setCaughtException(e);
}
else
{
asyncJobStatus.setCaughtException(new QException("Caught throwable", t));
}
getStateProvider().put(uuidAndTypeStateKey, asyncJobStatus); getStateProvider().put(uuidAndTypeStateKey, asyncJobStatus);
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// if user facing, just log an info, warn otherwise // // if user facing, just log an info, warn otherwise //
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
LOG.log((e instanceof QUserFacingException) ? Level.INFO : Level.WARN, "Job ended with an exception", e, logPair("jobId", uuidAndTypeStateKey.getUuid())); LOG.log((t instanceof QUserFacingException) ? Level.INFO : Level.WARN, "Job ended with an exception", t, logPair("jobId", uuidAndTypeStateKey.getUuid()));
throw (new CompletionException(e)); throw (new CompletionException(t));
} }
finally finally
{ {