Skip to content
forked from longkai/rfc7807

The Go implementation of Problem Details for HTTP APIs, defined in https://tools.ietf.org/html/rfc7807

License

Notifications You must be signed in to change notification settings

skailhq/rfc7807

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RFC 7807

GoDoc

Package rfc7807 implements RFC 7807, Problem Details for HTTP APIs: https://tools.ietf.org/html/rfc7807.

This package predefined Google's gRPC canonical error codes: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto.

To create a new problem detail:

rfc7807.New(rfc7807.NotFound, "xxx is not found.")

Or wrap with a underlying error:

rfc7807.Wrap(rfc7807.Internal, "", causeError)

It supports Go 2 error as values proposal: https://go.googlesource.com/proposal/+/master/design/29934-error-values.md.

If the predefined errors doesn't satisfy your needs:

rfc7807.Customize("my.error.domain", "MY_ERROR_TYPE", 400, nil, nil)

Install

go get github.com/skailhq/rfc7807

About

The Go implementation of Problem Details for HTTP APIs, defined in https://tools.ietf.org/html/rfc7807

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%