Crash on RuntimeExceptions thrown during all Jobs.

This commit is contained in:
Greyson Parrelli
2024-06-07 11:02:04 -04:00
committed by Alex Hart
parent 3beac6dfa9
commit 485b466bd2

View File

@@ -83,12 +83,15 @@ class JobRunner extends Thread {
try {
wakeLock = WakeLockUtil.acquire(application, PowerManager.PARTIAL_WAKE_LOCK, WAKE_LOCK_TIMEOUT, job.getId());
result = job.run();
result = job.run();
if (job.isCanceled()) {
Log.w(TAG, JobLogger.format(job, String.valueOf(id), "Failing because the job was canceled."));
result = Job.Result.failure();
}
} catch (RuntimeException e) {
Log.w(TAG, JobLogger.format(job, String.valueOf(id), "Failing fatally due to an unexpected runtime exception."), e);
return Job.Result.fatalFailure(e);
} catch (Exception e) {
Log.w(TAG, JobLogger.format(job, String.valueOf(id), "Failing due to an unexpected exception."), e);
return Job.Result.failure();