I am using CustomExceptionHandler in Sanic and logging errors on console by using:
class CustomExceptionHandler(ErrorHandler):
def default(self, request, exception):
response = None
if isinstance(exception, (SanicException, MethodNotSupported, NotFound,
Unauthorized, Forbidden, RequestTimeout, PayloadTooLarge)):
logger.info("Handled exception {}, for method {}".format(
exception.__class__.__name__, request.endpoint))
response = get_error_body_response(exception.args[0], exception.status_code)
return response
After upgrading to Sanic 21.3.2, I am not getting the request.endpoint
value, it is always None
for some reason
This is how I am creating my route:
basic = Blueprint('basic_blueprint', version=4)
@basic.route('/hello/<name:string>', methods=['GET'], name='hello')
I also tried using:
basic = Blueprint('basic_blueprint', version=4)
@basic.get('/hello/<name:string>', name='hello')