forked from CGM_Public/pretix_original
17 lines
505 B
Python
17 lines
505 B
Python
from rest_framework.response import Response
|
|
from rest_framework.views import exception_handler, status
|
|
|
|
from pretix.base.services.locking import LockTimeoutException
|
|
|
|
|
|
def custom_exception_handler(exc, context):
|
|
response = exception_handler(exc, context)
|
|
|
|
if isinstance(exc, LockTimeoutException):
|
|
response = Response(
|
|
{'detail': 'The server was too busy to process your request. Please try again.'},
|
|
status=status.HTTP_409_CONFLICT
|
|
)
|
|
|
|
return response
|