go-chi / go-chi/render

Make error a predefined variable for later comparision

Open
#24 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
339
Forks
66
PR merge metrics
No merged PRs in 30d

Description

https://github.com/go-chi/render/blob/3215478343fbc559bd3fc08f7031bb134d6bdad5/decoder.go#L30

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.

```golang
var (
ErrContentTypeNotSet = errors.New("render: missing content-type, unable to automatically decode the request content")
)
```
would be helpful.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.