diff --git a/bento_lib/package.cfg b/bento_lib/package.cfg index e7c2d6f..9cc1286 100644 --- a/bento_lib/package.cfg +++ b/bento_lib/package.cfg @@ -1,5 +1,5 @@ [package] name = bento_lib -version = 11.1.2 +version = 11.2.0 authors = David Lougheed, Paul Pillot author_emails = david.lougheed@mail.mcgill.ca, paul.pillot@computationalgenomics.ca diff --git a/bento_lib/responses/errors.py b/bento_lib/responses/errors.py index 23efe13..93b3663 100644 --- a/bento_lib/responses/errors.py +++ b/bento_lib/responses/errors.py @@ -12,6 +12,9 @@ "unauthorized_error", "forbidden_error", "not_found_error", + "not_acceptable_error", + "request_timeout_error", + "range_not_satisfiable_error", "internal_server_error", "not_implemented_error", @@ -87,6 +90,9 @@ def http_error( unauthorized_error = _e(401) forbidden_error = _e(403) not_found_error = _e(404) +not_acceptable_error = _e(406) +request_timeout_error = _e(408) +range_not_satisfiable_error = _e(416) internal_server_error = _e(500) not_implemented_error = _e(501) diff --git a/bento_lib/responses/flask_errors.py b/bento_lib/responses/flask_errors.py index d384e78..8762b7a 100644 --- a/bento_lib/responses/flask_errors.py +++ b/bento_lib/responses/flask_errors.py @@ -1,3 +1,4 @@ +import logging import sys import traceback @@ -19,6 +20,9 @@ "flask_unauthorized_error", "flask_forbidden_error", "flask_not_found_error", + "flask_not_acceptable_error", + "flask_request_timeout_error", + "flask_range_not_satisfiable_error", "flask_internal_server_error", "flask_not_implemented_error", @@ -37,7 +41,7 @@ def flask_error_wrap_with_traceback(fn: Callable, *args, **kwargs) -> Callable: service_name = kwargs.pop("service_name", "Bento Service") - logger = kwargs.pop("logger", None) + logger: logging.Logger | None = kwargs.pop("logger", None) authz: MarkAuthzDoneType | None = kwargs.pop("authz", None) def handle_error(e): @@ -84,6 +88,9 @@ def _flask_error(code: int) -> Callable: flask_unauthorized_error = _flask_error(401) flask_forbidden_error = _flask_error(403) flask_not_found_error = _flask_error(404) +flask_not_acceptable_error = _flask_error(406) +flask_request_timeout_error = _flask_error(408) +flask_range_not_satisfiable_error = _flask_error(416) flask_internal_server_error = _flask_error(500) flask_not_implemented_error = _flask_error(501)