fix: log unexpected errors server-side, return generic message to client (#991)#1057
Conversation
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
|
Thanks for your contribution. I updated the title and descriptions to make the CI works. |
| import uuid | ||
| from typing import Any, Literal, cast | ||
|
|
||
| logger = logging.getLogger(__name__) |
There was a problem hiding this comment.
I believe this line being here is what's causing the CI failure. Can you move this down to after all the imports?
|
Good catch, I'll move that import below the others and push. |
… to client (generative-computing#991) Signed-off-by: SAY-5 <say.apm35@gmail.com>
4c3905d to
64997cb
Compare
|
@SAY-5 looks like there's a test error |
|
The |
| import asyncio | ||
| import importlib.util | ||
| import inspect | ||
| import logging |
There was a problem hiding this comment.
We probably should use MelleaLogger instead of the python one
Switch the serve handler's logger from the stdlib logging.getLogger to MelleaLogger.get_logger so unhandled errors surface through the shared mellea logging configuration. Signed-off-by: SAY-5 <say.apm35@gmail.com>
|
Switched to MelleaLogger.get_logger in d2080c9. The 19 serve tests still pass locally. |
e2e1b5d
Misc PR
Type of PR
Description
The catch-all
except Exceptionincli/serve/app.pyhad two problems:f"Internal server error: {e!s}"returned arbitrarystr(e)content (file paths, internal module names, schema fragments) across the OpenAI-compatible API boundary.Replaces the handler with
logger.exception("Unhandled error in chat-completion handler")(full traceback, named logger) plus a generic client message. The explicitexcept ValueError400-mapping above it stays untouched, that path is intentional validation feedback.Testing
Attribution