Closed oliver-zhou closed 6 years ago
Hi @oliver-zhou, thanks for your report! There is already such a mechanism, but the readme lacks its description.
DEBUG
is set to the value of your Algolia setting RAISE_EXCEPTIONS
and defaults to Django's settings.DEBUG
.See the ChangeLog
of V1.3.0:
* [ADD] Option to raise or not exceptions. By default, raise only when DEBUG=True
And the code of settings.py
defining settings.DEBUG
:
from django.conf import settings
SETTINGS = settings.ALGOLIA
DEBUG = SETTINGS.get('RAISE_EXCEPTIONS', settings.DEBUG)
If you want to disable the raising of exceptions, simply set RAISE_EXCEPTIONS=False in your settings:
ALGOLIA = {
'APPLICATION_ID': 'MyAppID',
'API_KEY': 'MyApiKey',
'RAISE_EXCEPTIONS': False
}
I'll close this feature request as the feature is already implemented, and will improve its documentation in the readme. Let me know if this works for you!
Documented in 7ce0caffee5c8cb5880439b6cbc275691f5a4afd.
Running and testing locally is difficult when I have an unstable/no internet connection, yielding this exception:
There should be a mechanism to automatically swallow these errors. It seems these exceptions are run as warnings instead of exceptions in production, this behavior should be allowed to persist when DEBUG=True still if given a flag in settings or something.
I can make a pull request if that's something that makes sense
Line in question:
https://github.com/algolia/algoliasearch-django/blob/4987a5df2d7cdcb0e81563babcf0c7f5aeba6a05/algoliasearch_django/models.py#L297-L302