usererror

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package usererror creates errors that are expected from a user making a mistake.

Index

Constants

View Source
const (
	ReasonDuplicate = "duplicate"
	ReasonInvalid   = "invalid"
)

Error reasons.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message string
	Reason  Reason
}

Error returns a message to the user.

func Duplicate

func Duplicate(field, value string) *Error

Duplicate creates a new duplicate error.

func Invalid

func Invalid(message string) *Error

Invalid returns a new invalid error.

func (*Error) Error

func (e *Error) Error() string

type Reason

type Reason string

Reason is the reason that the user error occurred.

Jump to

Keyboard shortcuts

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