From 58012366f3a70add0b4582d84b98669d74f1a63c Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Fri, 30 Dec 2016 12:22:24 -0600 Subject: [PATCH] Change to contextlib.suppress, a bit cleaner --- sanic/sanic.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sanic/sanic.py b/sanic/sanic.py index 2f5a405a..8038c73b 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -1,5 +1,6 @@ from asyncio import get_event_loop from collections import deque +from contextlib import suppress from functools import partial from inspect import isawaitable, stack, getmodulename from multiprocessing import Process, Event @@ -219,11 +220,8 @@ class Sanic: # -------------------------------------------- # if self.debug: error_body = response.body - if isinstance(error_body, bytes): - try: - error_body = error_body.decode() - except: - pass + with suppress(Exception): + error_body = error_body.decode() log.debug(error_body) try: