package
0.0.0-20250213232608-c453f8b35c75
Repository: https://github.com/stellar/go.git
Documentation: pkg.go.dev

# Functions

IsKnownError maps an error to a list of known errors.
MakeInvalidFieldProblem is a helper function to make a BadRequest with extras.
New returns a new instance of Problem.
NewProblemWithInvalidField creates a copy of the given problem, setting the invalid_field key in extras with the given reason.
RegisterError records an error -> P mapping, allowing the app to register specific errors that may occur in other packages to be rendered as a specific P instance.
RegisterHost registers the service host url.
RegisterReportFunc registers the report function that you want to use to report errors.
Render writes a http response to `w`, compliant with the "Problem Details for HTTP APIs" RFC: https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00.
SetLogFilter sets log filter of the default Problem.
UnRegisterErrors removes all registered errors.

# Constants

LogAllErrors indicates that the Problem instance should log all errors.
LogNoErrors indicates that the Problem instance should not log any errors.
LogUnknownErrors indicates that the Problem instance should only log errors which are not registered.

# Variables

BadRequest is a well-known problem type.
Default is the problem instance used by the package functions providing a global state registry and rendering of problems for an application.
DefaultLogger is the default logger used with the default problem instance.
DefaultServiceHost is the default service host used with the default problem instance.
NotFound is a well-known problem type.
ServerError is a well-known problem type.

# Structs

P is a struct that represents an error response to be rendered to a connected client.
Problem is an instance of the functionality served by the problem package.

# Type aliases

LogFilter describes which errors should be logged when terminating requests in Problem.Render().
ReportFunc is a function type used to report unexpected errors.