The implementation from #250 contains a few type assertions which are not safe, e.g.
if err != nil {
// if there's an args error, print it in a user-friendly way
prettyErr, ok := err.(types.Prettier)
...
or
switch t := err.(type) {
case *query.ArgsError:
vr.ArgsError = t
default:
LogAndAbort(ctx, c, http.StatusInternalServerError, err)
return
}
The issue with these assertions is that they won't work on wrapped errors (which may or may not be present, but might of course at any point in time). Best practices suggest to use errors.As() instead.
The implementation from #250 contains a few type assertions which are not safe, e.g.
or
The issue with these assertions is that they won't work on wrapped errors (which may or may not be present, but might of course at any point in time). Best practices suggest to use
errors.As()
instead.