From 66c380548bd49cec697b7089dea5c18bbb38d7a8 Mon Sep 17 00:00:00 2001 From: Raphael Deem Date: Thu, 23 Feb 2017 23:17:31 -0800 Subject: [PATCH] use getattr for request url in error handler --- sanic/handlers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sanic/handlers.py b/sanic/handlers.py index 7ae30af9..d5a5d0dd 100644 --- a/sanic/handlers.py +++ b/sanic/handlers.py @@ -53,10 +53,11 @@ class ErrorHandler: except Exception: self.log(format_exc()) if self.debug: + url = getattr(request, 'url', 'unknown') response_message = ( 'Exception raised in exception handler "{}" ' 'for uri: "{}"\n{}').format( - handler.__name__, request.url, format_exc()) + handler.__name__, url, format_exc()) log.error(response_message) return text(response_message, 500) else: