fix 739
This commit is contained in:
parent
a6dc4646db
commit
58a9c92d75
|
@ -1,3 +1,5 @@
|
||||||
|
from sanic.response import ALL_STATUS_CODES
|
||||||
|
|
||||||
TRACEBACK_STYLE = '''
|
TRACEBACK_STYLE = '''
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
@ -117,11 +119,13 @@ INTERNAL_SERVER_ERROR_HTML = '''
|
||||||
|
|
||||||
class SanicException(Exception):
|
class SanicException(Exception):
|
||||||
|
|
||||||
def __init__(self, message, status_code=None):
|
def __init__(self, message=None, status_code=None):
|
||||||
super().__init__(message)
|
|
||||||
|
|
||||||
if status_code is not None:
|
if status_code is not None:
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
|
if message is None:
|
||||||
|
message = ALL_STATUS_CODES.get(status_code)
|
||||||
|
|
||||||
|
super().__init__(message)
|
||||||
|
|
||||||
|
|
||||||
class NotFound(SanicException):
|
class NotFound(SanicException):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user