From 95e20f8eb7a2b3c6f73c8f51c44aa974c5223701 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Thu, 18 Jan 2024 19:44:50 +0800 Subject: [PATCH] fix: error count representation Signed-off-by: Frost Ming --- src/_bentoml_impl/server/app.py | 2 +- src/_bentoml_sdk/service/factory.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_bentoml_impl/server/app.py b/src/_bentoml_impl/server/app.py index 43cc194b4e3..49206805ca4 100644 --- a/src/_bentoml_impl/server/app.py +++ b/src/_bentoml_impl/server/app.py @@ -132,7 +132,7 @@ async def handle_validation_error(self, req: Request, exc: Exception) -> Respons assert isinstance(exc, pydantic.ValidationError) data = { - "error": f"{exc.error_count} validation error for {exc.title}", + "error": f"{exc.error_count()} validation error for {exc.title}", "detail": exc.errors(), } return JSONResponse(data, status_code=400) diff --git a/src/_bentoml_sdk/service/factory.py b/src/_bentoml_sdk/service/factory.py index bb432e18b5a..a0f89c1d3cf 100644 --- a/src/_bentoml_sdk/service/factory.py +++ b/src/_bentoml_sdk/service/factory.py @@ -172,7 +172,7 @@ def import_string(self) -> str: assert isinstance(import_module, str) try: import_module_path = pathlib.Path(import_module).relative_to( - pathlib.Path(self.working_dir) + self.working_dir ) except ValueError: raise BentoMLException(