diff --git a/dojo/cli.py b/dojo/cli.py index 07cb84cc16c95d1c7df766d1bf87be7e8d08b041..9e5aa6f7d8edfe513ccd3cbed5172db66067f0e8 100644 --- a/dojo/cli.py +++ b/dojo/cli.py @@ -1,6 +1,7 @@ import click import logging + from .run import Entrypoint from .secrets import Secrets diff --git a/dojo/run.py b/dojo/run.py index b78443367995562bf590e011b7cb65d31ef657b7..7aa56e8feebdb2f23e5127e52fc580714a31e40c 100644 --- a/dojo/run.py +++ b/dojo/run.py @@ -46,7 +46,16 @@ class Entrypoint(object): raise ValueError('specified runner "%s" is not supported by job type %s, only %s' % (runner_name, job.__class__.__name__, job.RUNNERS.keys())) runner_class = job.RUNNERS[runner_name] - runner_class().run(job, config) + try: + runner_class().run(job, config) + except Exception as error: + if job.config['errors'] is not None: + job.config['errors']( + job.config, + job.secrets['errors'], + env + ).capture(error) + raise error def _build_job(self, job_name, config, secrets, runner): job_config = config.get('jobs', {}).get(job_name, {}) @@ -66,6 +75,11 @@ class Entrypoint(object): if 'store' in job_config and 'connection' in job_config['store']: job_secrets['store']['connection'] = secrets.get('connections', {}).get(job_config['store']['connection'],) + if 'errors' in config: + job_config['errors'] = self._get_module_class(config['errors']['adapter']) + if 'errors' in secrets: + job_secrets['errors'] = secrets.get('errors', {}) + job_connection = job_config.get('connection') if isinstance(job_connection, str): job_config['connection'] = config['connections'].get(job_connection, {}) diff --git a/setup.py b/setup.py index 56f9c6a785496e49bd78ac8d64ffcd0fb417b7cf..8600659fe414fc32b7de11b513e76da08cce8889 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ from setuptools import setup, find_packages setup( name='dojo', - version='0.0.42', + version='0.0.44', description='A framework for building and running your data platform.', author='Data Up', author_email='dojo@dataup.me',