Documentation ¶
Overview ¶
Package errors provides custom error types for the application.
Index ¶
Constants ¶
View Source
const ( // ErrNilLogger is returned when a nil logger is passed to a function. ErrNilLogger xerrors.Error = "logger cannot be nil" // ErrEmptyDSN is returned when an empty DSN is passed to a function. ErrEmptyDSN xerrors.Error = "dsn cannot be empty" )
Variables ¶
This section is empty.
Functions ¶
func JSON ¶
func JSON(w http.ResponseWriter, logger *zap.Logger, response ErrorResponse)
JSON sends an ErrorResponse to the HTTP response writer as JSON.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { // Message is a human-readable message describing the error. Message string `json:"message"` // Code is a machine-readable code describing the error. Code uint `json:"code"` }
ErrorResponse is the response returned by the API when an error occurs.
Click to show internal directories.
Click to hide internal directories.