File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ def __init__(self, **kwargs):
3838 self .name = self .__class__ .__name__
3939 self .http_events .fast_api_name = self .name
4040
41+ # todo: improve the error handling of validation errors (namley from Type_Safe_Primitive)
42+ # see code example in https://claude.ai/chat/f443e322-fa43-487f-9dd9-2d4cfb261b1e
4143 def add_global_exception_handlers (self ):
4244 import traceback
4345 from fastapi import Request , HTTPException
Original file line number Diff line number Diff line change @@ -106,8 +106,8 @@ def wrapper(**kwargs):
106106 result = function (** converted_kwargs ) # Call original function
107107 except HTTPException :
108108 raise # Re-raise HTTPException unchanged
109- # except RequestValidationError:
110- # raise # also re-raise RequestValidationError
109+ except RequestValidationError :
110+ raise # also re-raise RequestValidationError
111111 except Exception as e :
112112 raise HTTPException (status_code = 400 , detail = f"{ type (e ).__name__ } : { e } " ) # Convert exceptions to HTTP 400
113113
You can’t perform that action at this time.
0 commit comments