You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
err=errors.New("render: unable to automatically decode the request content type")
If the returned error are defined var, it would be possible to compare and know what exactly happened. The error message from render package cannot be directly to client in most cases, but application developer would like to return some custom error.
var (
ErrContentTypeNotSet=errors.New("render: missing content-type, unable to automatically decode the request content")
)
would be helpful.
The text was updated successfully, but these errors were encountered:
rskumar
added a commit
to rskumar/render
that referenced
this issue
Aug 27, 2019
@ptman error interface is generic. Just Error() doesn't let me know exact what happened and can we handle it and what specifc msg we need to show to client. Even in link you shared, there are example of where to use vars like iot.EOF or sql.ErrNoRows.
For me, anonymous errors.New("") are useless and I consider it as one that cannot be processed confidently other than printing to log. cockroachdb/errors repo has a very indepth comparative analysis on different mechanisms.
You misunderstand me. I suggest not using errors.New() but instead using constant errors, like in the article, that satisfy the error interface. Those can be compared.
render/decoder.go
Line 30 in 3215478
If the returned error are defined var, it would be possible to compare and know what exactly happened. The error message from render package cannot be directly to client in most cases, but application developer would like to return some custom error.
would be helpful.
The text was updated successfully, but these errors were encountered: