mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-19 06:38:41 +00:00
append the error in the internal server error
undo the linter changes catch the assert error and report to the client fix linter issue convert asserts to raise exception for better error hanlding translate assert to exception accordingly
This commit is contained in:
parent
1619d37cc6
commit
663f222ffd
2 changed files with 19 additions and 8 deletions
|
|
@ -97,6 +97,10 @@ def translate_exception(exc: Exception) -> Union[HTTPException, RequestValidatio
|
|||
)
|
||||
elif isinstance(exc, ValueError):
|
||||
return HTTPException(status_code=400, detail=f"Invalid value: {str(exc)}")
|
||||
elif isinstance(exc, TypeError):
|
||||
return HTTPException(status_code=400, detail=f"Type Error: {str(exc)}")
|
||||
elif isinstance(exc, KeyError):
|
||||
return HTTPException(status_code=400, detail=f"Key Error: {str(exc)}")
|
||||
elif isinstance(exc, PermissionError):
|
||||
return HTTPException(status_code=403, detail=f"Permission denied: {str(exc)}")
|
||||
elif isinstance(exc, TimeoutError):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue