1 from authosm
.exceptions
import OSMAuthException
2 from django
.shortcuts
import render
5 class OsmProjectMiddleware(object):
6 def process_view(self
, request
, view_func
, view_args
, view_kwargs
):
9 def process_exception(self
, request
, exception
):
10 if isinstance(exception
, OSMAuthException
):
12 error_message
= exception
.message
['detail']
13 except Exception as e
:
15 error_message
= 'Unknown error'
16 return render(request
, 'error.html', {'error_message': error_message
, 'collapsed_sidebar': False})