domainErr

package
v0.0.0-...-a3ed9dc Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotFound            = "NOT_FOUND"
	BadRequest          = "BAD_REQUEST"
	Unauthorized        = "UNAUTHORIZED"
	InternalServerError = "INTERNAL_SERVER_ERROR"
)

const will be used for the status of api handlers.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

APIError struct contains the code and message of error.

func NewAPIError

func NewAPIError(errType string, message string) *APIError

NewAPIError returns the error type and error message.

func (*APIError) Error

func (a *APIError) Error() string

func (*APIError) IsError

func (a *APIError) IsError(errType string) bool

IsError will return whether error exists or not.

type APIErrors

type APIErrors struct {
	Code    string   `json:"code"`
	Message []string `json:"message"`
}

func NewAPIErrors

func NewAPIErrors(errType string, message []string) *APIErrors

func (*APIErrors) Error

func (a *APIErrors) Error() []string

Jump to

Keyboard shortcuts

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