fixing static request handler logging exception on 404 (#2099)

* fixing static request handler logging exception when not necessary, adding test to verify exception is gone on 404

* Fixup tests

* Fix tests

* resolve test failure

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
This commit is contained in:
Frederik Gelder
2021-04-06 21:20:25 +02:00
committed by GitHub
parent b716f48c84
commit 8f06d035cb
4 changed files with 46 additions and 10 deletions

View File

@@ -718,16 +718,18 @@ class RouteMixin:
return await file(file_path, headers=headers, _range=_range)
except ContentRangeError:
raise
except Exception:
error_logger.exception(
f"File not found: path={file_or_directory}, "
f"relative_url={__file_uri__}"
)
except FileNotFoundError:
raise FileNotFound(
"File not found",
path=file_or_directory,
relative_url=__file_uri__,
)
except Exception:
error_logger.exception(
f"Exception in static request handler:\
path={file_or_directory}, "
f"relative_url={__file_uri__}"
)
def _register_static(
self,