cleanup imports on error.py
This commit is contained in:
parent
62e045fb66
commit
301c82110a
|
@ -3,6 +3,7 @@ import traceback
|
|||
from sanic import response
|
||||
|
||||
from .log import logging
|
||||
from .templates import error
|
||||
|
||||
|
||||
def logstr(request, status, e=False):
|
||||
|
@ -13,24 +14,20 @@ def logstr(request, status, e=False):
|
|||
|
||||
|
||||
def not_found(request, exception):
|
||||
from .templates import error
|
||||
return error(request, f'Not found: {request.path}', 404)
|
||||
|
||||
|
||||
def method_not_supported(request, exception):
|
||||
from .templates import error
|
||||
return error(request, f'Invalid method: {request.method}', 405)
|
||||
|
||||
|
||||
def server_error(request, exception):
|
||||
from .templates import error
|
||||
logstr(request, 500, e=exception)
|
||||
msg = 'OOPSIE WOOPSIE!! Uwu We made a fucky wucky!! A wittle fucko boingo! The code monkeys at our headquarters are working VEWY HAWD to fix this!'
|
||||
return error(request, msg, 500)
|
||||
|
||||
|
||||
def no_template(request, exception):
|
||||
from .templates import error
|
||||
logstr(request, 500, e=exception)
|
||||
msg = 'I\'m a dumbass and forgot to create a template for this page'
|
||||
return error(request, msg, 500)
|
||||
|
|
Loading…
Reference in a new issue