Closed
Description
I need to treat some binding errors, like invalid time format when unmarshaling json from the payload.
It wold be nice to have a property on the echo.HTTPError with the original error reference. Something like InnerError
(inner exception, as in .Net) or OriginalError
.
This would be useful to know what caused the HTTPError aside from looking at the error message. Eg:
var myType MyType
err := c.Bind(&myType)
if err != nil {
if parseError, ok := err.OriginalError.(json.UnmarshalTypeError); ok {
fmt.Println("Error parsing field:", parseError.Field)
}
// ...
}
// ...