Change to contextlib.suppress, a bit cleaner
This commit is contained in:
parent
683c0c1390
commit
58012366f3
|
@ -1,5 +1,6 @@
|
||||||
from asyncio import get_event_loop
|
from asyncio import get_event_loop
|
||||||
from collections import deque
|
from collections import deque
|
||||||
|
from contextlib import suppress
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from inspect import isawaitable, stack, getmodulename
|
from inspect import isawaitable, stack, getmodulename
|
||||||
from multiprocessing import Process, Event
|
from multiprocessing import Process, Event
|
||||||
|
@ -219,11 +220,8 @@ class Sanic:
|
||||||
# -------------------------------------------- #
|
# -------------------------------------------- #
|
||||||
if self.debug:
|
if self.debug:
|
||||||
error_body = response.body
|
error_body = response.body
|
||||||
if isinstance(error_body, bytes):
|
with suppress(Exception):
|
||||||
try:
|
error_body = error_body.decode()
|
||||||
error_body = error_body.decode()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
log.debug(error_body)
|
log.debug(error_body)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user