errors

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package errors wraps driver and changeset error as a grimoire's error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message string `json:"message"`
	Field   string `json:"field,omitempty"`
	Code    int    `json:"code,omitempty"`
	// contains filtered or unexported fields
}

Error defines information about grimoire's error.

func New

func New(message string, field string, kind Kind) Error

New creates an error.

func NewUnexpected

func NewUnexpected(message string) Error

NewUnexpected creates an error.

func NewWithCode

func NewWithCode(message string, field string, code int, kind Kind) Error

NewWithCode creates an error with code.

func (Error) Error

func (e Error) Error() string

Error prints error message.

func (Error) Kind

func (e Error) Kind() Kind

Kind of error.

type Kind

type Kind int
const (
	Unexpected Kind = iota
	Changeset
	NotFound
	UniqueConstraint
	ForeignKeyConstraint
	CheckConstraint
)

Jump to

Keyboard shortcuts

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