-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to override default error handling behaviour
By default errors raised in side-effects functions are logged and then thrown away. This is by design. Side-effects should not, by definition, halt the normal flow, however in certain circumstances (e.g. testing) this may not be desirable. This commit introduces a setting 'SUPPRESS_ERRORS', which is True by default, but can be overridden by setting the env var 'SIDE_EFFECTS_SUPPRESS_ERRORS' to 'False'.
- Loading branch information
1 parent
0c1a01f
commit e544edd
Showing
6 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,27 @@ | |
|
||
setup( | ||
name="django-side-effects", | ||
version="0.2", | ||
version="0.2.1", | ||
packages=find_packages(), | ||
include_package_data=True, | ||
install_requires=['Django>=1.8'], | ||
description='Django app for managing external side effects.', | ||
long_description=README, | ||
url='https://github.com/yunojuno/django-side-effects', | ||
install_requires=[ | ||
'django>=1.9', | ||
'python-env-utils' | ||
], | ||
author='YunoJuno', | ||
author_email='[email protected]', | ||
license='MIT', | ||
maintainer='YunoJuno', | ||
maintainer_email='[email protected]', | ||
classifiers=[ | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Framework :: Django :: 1.9', | ||
'Framework :: Django :: 1.10', | ||
'Framework :: Django :: 1.11', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
default_app_config = 'side_effects.apps.SideEffectsConfig' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from env_utils import get_bool | ||
|
||
from django.conf import settings | ||
|
||
# If True then do not raise exceptions caught when running | ||
# side-effects, but just log them instead. | ||
# Default = True | ||
SUPPRESS_ERRORS = getattr( | ||
settings, 'SIDE_EFFECTS_SUPPRESS_ERRORS', | ||
get_bool('SIDE_EFFECTS_SUPPRESS_ERRORS', True) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters