# README
RFC 7807
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
# Constants
The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
The entity that a client attempted to create (e.g., file or directory) already exists.
The operation was cancelled, typically by the caller.
Unrecoverable data loss or corruption.
The deadline expired before the operation could complete.
Service implementors can use the following guidelines to decide between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: (a) Use `UNAVAILABLE` if the client can retry just the failing call.
Internal errors.
The client specified an invalid argument.
Some requested entity (e.g., file or directory) was not found.
The operation was attempted past the valid range.
The caller does not have permission to execute the specified operation.
Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
The request does not have valid authentication credentials for the operation.
The service is currently unavailable.
The operation is not implemented or is not supported/enabled in this service.
Unknown error.
# Structs
ProblemDetails is the entity of RFC 7807.
# Type aliases
Code represent the gRPC standard error codes.