##// END OF EJS Templates
vcs: Use response header to decide if error handling is needed.
Martin Bornhold -
r609:24f4767a default
parent child Browse files
Show More
@@ -200,19 +200,21 b' def make_not_found_view(config):'
200 200 - old webob type exceptions get converted to pyramid exceptions
201 201 - pyramid exceptions are passed to the error handler view
202 202 """
203 def is_vcs_request(request):
204 return True == request.environ.get(
205 'rhodecode.vcs.skip_error_handling')
203 def is_vcs_response(response):
204 return 'X-RhodeCode-Backend' in response.headers
206 205
207 def is_webob_error(response):
206 def is_http_error(response):
208 207 # webob type error responses
209 208 return (400 <= response.status_int <= 599)
210 209
210 def is_error_handling_needed(response):
211 return is_http_error(response) and not is_vcs_response(response)
212
211 213 try:
212 214 response = pylons_app_as_view(context, request)
213 if is_webob_error(response) and not is_vcs_request(request):
214 return error_handler(
215 webob_to_pyramid_http_response(response), request)
215 if is_error_handling_needed(response):
216 response = webob_to_pyramid_http_response(response)
217 return error_handler(response, request)
216 218 except HTTPError as e: # pyramid type exceptions
217 219 return error_handler(e, request)
218 220 except Exception:
General Comments 0
You need to be logged in to leave comments. Login now