No logging of exception
This commit is contained in:
parent
2e36507a60
commit
ca0e933813
@ -58,7 +58,7 @@ class DirectoryHandler:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def default_handler(
|
def default_handler(
|
||||||
cls, request: Request, exception: SanicIsADirectoryError
|
cls, request: Request, exception: SanicIsADirectoryError
|
||||||
) -> Optional[Union[HTTPResponse, Coroutine[Any, Any, HTTPResponse]]]:
|
) -> Optional[Coroutine[Any, Any, HTTPResponse]]:
|
||||||
if exception.autoindex or exception.index_name:
|
if exception.autoindex or exception.index_name:
|
||||||
maybe_response = DirectoryHandler(
|
maybe_response = DirectoryHandler(
|
||||||
exception.location, exception.autoindex, exception.index_name
|
exception.location, exception.autoindex, exception.index_name
|
||||||
|
@ -27,7 +27,12 @@ from sanic.base.meta import SanicMeta
|
|||||||
from sanic.compat import stat_async
|
from sanic.compat import stat_async
|
||||||
from sanic.constants import DEFAULT_HTTP_CONTENT_TYPE, HTTP_METHODS
|
from sanic.constants import DEFAULT_HTTP_CONTENT_TYPE, HTTP_METHODS
|
||||||
from sanic.errorpages import RESPONSE_MAPPING
|
from sanic.errorpages import RESPONSE_MAPPING
|
||||||
from sanic.exceptions import FileNotFound, HeaderNotFound, RangeNotSatisfiable
|
from sanic.exceptions import (
|
||||||
|
FileNotFound,
|
||||||
|
HeaderNotFound,
|
||||||
|
RangeNotSatisfiable,
|
||||||
|
SanicIsADirectoryError,
|
||||||
|
)
|
||||||
from sanic.handlers import ContentRangeHandler
|
from sanic.handlers import ContentRangeHandler
|
||||||
from sanic.log import error_logger
|
from sanic.log import error_logger
|
||||||
from sanic.models.futures import FutureRoute, FutureStatic
|
from sanic.models.futures import FutureRoute, FutureStatic
|
||||||
@ -910,7 +915,7 @@ class RouteMixin(metaclass=SanicMeta):
|
|||||||
autoindex=autoindex,
|
autoindex=autoindex,
|
||||||
index_name=index_name,
|
index_name=index_name,
|
||||||
)
|
)
|
||||||
except RangeNotSatisfiable:
|
except (RangeNotSatisfiable, SanicIsADirectoryError):
|
||||||
raise
|
raise
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise not_found
|
raise not_found
|
||||||
|
@ -27,7 +27,7 @@ class BasePage(ABC):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def style(self) -> str:
|
def style(self) -> str:
|
||||||
return f"{self.BASE_STYLE}\n{self.EXTRA_STYLE}"
|
return self.BASE_STYLE + self.EXTRA_STYLE
|
||||||
|
|
||||||
def render(self) -> str:
|
def render(self) -> str:
|
||||||
self._head()
|
self._head()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user