##// END OF EJS Templates
error-handling: show tracebacks only for error code 500 and above.
marcink -
r1314:45697948 default
parent child Browse files
Show More
@@ -227,13 +227,19 b' def error_handler(exception, request):'
227 log.exception('failed to fetch settings')
227 log.exception('failed to fetch settings')
228 rc_config = {}
228 rc_config = {}
229
229
230 log.exception(
231 'error occurred handling this request for path: %s', request.path)
232 base_response = HTTPInternalServerError()
230 base_response = HTTPInternalServerError()
233 # prefer original exception for the response since it may have headers set
231 # prefer original exception for the response since it may have headers set
234 if isinstance(exception, HTTPError):
232 if isinstance(exception, HTTPError):
235 base_response = exception
233 base_response = exception
236
234
235 def is_http_error(response):
236 # error which should have traceback
237 return response.status_code > 499
238
239 if is_http_error(base_response):
240 log.exception(
241 'error occurred handling this request for path: %s', request.path)
242
237 c = AttributeDict()
243 c = AttributeDict()
238 c.error_message = base_response.status
244 c.error_message = base_response.status
239 c.error_explanation = base_response.explanation or str(base_response)
245 c.error_explanation = base_response.explanation or str(base_response)
General Comments 0
You need to be logged in to leave comments. Login now