Log errors when jobs fail
This commit is contained in:
parent
fff4e9e97f
commit
c6aa668a9b
1 changed files with 4 additions and 1 deletions
|
@ -10,6 +10,7 @@ import { ParsedJob, StoredJob, JobQueueStore } from './types';
|
||||||
import { assert } from '../util/assert';
|
import { assert } from '../util/assert';
|
||||||
import * as log from '../logging/log';
|
import * as log from '../logging/log';
|
||||||
import { JobLogger } from './JobLogger';
|
import { JobLogger } from './JobLogger';
|
||||||
|
import * as Errors from '../types/errors';
|
||||||
|
|
||||||
const noopOnCompleteCallbacks = {
|
const noopOnCompleteCallbacks = {
|
||||||
resolve: noop,
|
resolve: noop,
|
||||||
|
@ -226,7 +227,9 @@ export abstract class JobQueue<T> {
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
result = { success: false, err };
|
result = { success: false, err };
|
||||||
log.error(
|
log.error(
|
||||||
`${this.logPrefix} job ${storedJob.id} failed on attempt ${attempt}`
|
`${this.logPrefix} job ${
|
||||||
|
storedJob.id
|
||||||
|
} failed on attempt ${attempt}. ${Errors.toLogFormat(err)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue