mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
c1e3788570
refs https://github.com/TryGhost/Ghost-Utils/issues/118 - Duplicating error handling across jobs is not best developer experience. Also, having custom error handling logic did not allow for recommended worker script behavior: allowing for unhandled exceptions to bubble up and be managed by parent process
17 lines
572 B
JavaScript
17 lines
572 B
JavaScript
/**
|
|
* Minimal wrapper around our external lib
|
|
* Intended for passing any Ghost internals such as logging and config
|
|
*/
|
|
|
|
const JobManager = require('@tryghost/job-manager');
|
|
const logging = require('../../../shared/logging');
|
|
const sentry = require('../../../shared/sentry');
|
|
|
|
const errorHandler = (error, workerMeta) => {
|
|
logging.info(`Capturing error for worker during execution of job: ${workerMeta.name}`);
|
|
logging.error(error);
|
|
sentry.captureException(error);
|
|
};
|
|
const jobManager = new JobManager({logging, errorHandler});
|
|
|
|
module.exports = jobManager;
|