Log errors when jobs fail

This commit is contained in:
Evan Hahn 2021-08-25 18:58:33 -05:00 committed by GitHub
parent fff4e9e97f
commit c6aa668a9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import { ParsedJob, StoredJob, JobQueueStore } from './types';
import { assert } from '../util/assert';
import * as log from '../logging/log';
import { JobLogger } from './JobLogger';
import * as Errors from '../types/errors';
const noopOnCompleteCallbacks = {
resolve: noop,
@ -226,7 +227,9 @@ export abstract class JobQueue<T> {
} catch (err: unknown) {
result = { success: false, err };
log.error(
`${this.logPrefix} job ${storedJob.id} failed on attempt ${attempt}`
`${this.logPrefix} job ${
storedJob.id
} failed on attempt ${attempt}. ${Errors.toLogFormat(err)}`
);
}
}