@@ -120,14 +120,25 @@ func ValidateRequestFromContext(ctx echo.Context, router *openapi3filter.Router,
120120 // Split up the verbose error by lines and return the first one
121121 // openapi errors seem to be multi-line with a decent message on the first
122122 errorLines := strings .Split (e .Error (), "\n " )
123- return echo .NewHTTPError (http .StatusBadRequest , errorLines [0 ])
123+ return & echo.HTTPError {
124+ Code : http .StatusBadRequest ,
125+ Message : errorLines [0 ],
126+ Internal : err ,
127+ }
124128 case * openapi3filter.SecurityRequirementsError :
125- return echo .NewHTTPError (http .StatusForbidden , e .Error ())
129+ return & echo.HTTPError {
130+ Code : http .StatusForbidden ,
131+ Message : e .Error (),
132+ Internal : err ,
133+ }
126134 default :
127135 // This should never happen today, but if our upstream code changes,
128136 // we don't want to crash the server, so handle the unexpected error.
129- return echo .NewHTTPError (http .StatusInternalServerError ,
130- fmt .Sprintf ("error validating request: %s" , err ))
137+ return & echo.HTTPError {
138+ Code : http .StatusInternalServerError ,
139+ Message : fmt .Sprintf ("error validating request: %s" , err ),
140+ Internal : err ,
141+ }
131142 }
132143 }
133144 return nil
0 commit comments