mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
catch any throwable
This commit is contained in:
@ -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);
|
||||||
|
if(t instanceof Exception e)
|
||||||
|
{
|
||||||
asyncJobStatus.setCaughtException(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
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user