From f4a7a4fb59f1de7020a632e38e6fdf1521d92df0 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Wed, 23 Aug 2023 13:59:44 +0100 Subject: [PATCH] Fix bug in generic exception handling Generic error handling passes correct request and exception arguments. --- CHANGELOG.md | 4 +++- fastapi_mlflow/applications.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7f05f4..ed1f850 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed +- Generic error handling passes correct request and exception arguments -## [0.6.0.beta1] - 2023-08-23 +## [0.6.0] - 2023-08-23 ### Changed - Return an asynchronous function from build_predictor - Use orjson to serialize responses from app returned by build_app diff --git a/fastapi_mlflow/applications.py b/fastapi_mlflow/applications.py index 7f32a0a..f049fd7 100644 --- a/fastapi_mlflow/applications.py +++ b/fastapi_mlflow/applications.py @@ -37,9 +37,9 @@ def handle_serialisable_exception( ) @app.exception_handler(Exception) - def handle_exception(_: Request, exc: Exception) -> ORJSONResponse: + def handle_exception(req: Request, exc: Exception) -> ORJSONResponse: return handle_serialisable_exception( - DictSerialisableException.from_exception(exc) + req, DictSerialisableException.from_exception(exc) ) return app