errors

package
v0.0.0-...-a121bc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2023 License: EUPL-1.2 Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL