diff --git a/src/pretix/api/exception.py b/src/pretix/api/exception.py index eaf5f48731..6f5e1c7fcf 100644 --- a/src/pretix/api/exception.py +++ b/src/pretix/api/exception.py @@ -19,12 +19,19 @@ # You should have received a copy of the GNU Affero General Public License along with this program. If not, see # . # +import logging + +import ujson +from rest_framework import exceptions from rest_framework.response import Response from rest_framework.views import exception_handler, status from pretix.base.services.locking import LockTimeoutException +logger = logging.getLogger(__name__) + + def custom_exception_handler(exc, context): response = exception_handler(exc, context) @@ -37,4 +44,7 @@ def custom_exception_handler(exc, context): } ) + if isinstance(exc, exceptions.APIException): + logger.info(f'API Exception [{exc.status_code}]: {ujson.dumps(exc.detail)}') + return response