exceptions

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const GENERAL string = "GENERAL_ERROR"

GENERAL is default status code

Variables

This section is empty.

Functions

func ThrowClientErrorException added in v0.1.3

func ThrowClientErrorException(code string, status http.StatusCode, payload api.Payload, headers ...api.ResponseHeader)

ThrowClientErrorException panic with an client error exception object filled with given data

func ThrowException added in v0.1.2

func ThrowException(code string, status http.StatusCode, message string, errorMessage string)

ThrowException panic with an exception object filled with given data

func ThrowValidationException added in v0.1.2

func ThrowValidationException(code string, message string, errorBag shark.ErrorBag)

ThrowValidationException panics a validation exception with given data

Types

type AggregatedRoutineException

type AggregatedRoutineException struct {
	// contains filtered or unexported fields
}

AggregatedRoutineException is aggregate of routine exceptions of a single event

func NewAggregatedRoutineException

func NewAggregatedRoutineException(
	message string,
	errorMessage string,
	code string, status http.StatusCode,
	errors []RoutineException,
) AggregatedRoutineException

NewAggregatedRoutineException generate an aggregate routine exception

func (AggregatedRoutineException) GetCode

func (e AggregatedRoutineException) GetCode() string

GetCode returns exception code

func (AggregatedRoutineException) GetErrorMessage

func (e AggregatedRoutineException) GetErrorMessage() string

GetErrorMessage returns exception error Message

func (AggregatedRoutineException) GetMessage

func (e AggregatedRoutineException) GetMessage() string

GetMessage returns exception end user readable Message

func (AggregatedRoutineException) GetStatus

GetStatus returns http status code

func (AggregatedRoutineException) GetTags

func (e AggregatedRoutineException) GetTags() map[string]string

GetTags returns list of informational tags for reporting

func (AggregatedRoutineException) ShouldReport

func (e AggregatedRoutineException) ShouldReport() bool

ShouldReport determine that whether the panic should be reported

type ClientErrorException added in v0.1.3

type ClientErrorException struct {
	// contains filtered or unexported fields
}

Exception is an exception for fatal error happened in runtime

func (ClientErrorException) GetCode added in v0.1.3

func (e ClientErrorException) GetCode() string

GetCode returns exception code

func (ClientErrorException) GetHeaders added in v0.1.3

func (e ClientErrorException) GetHeaders() []api.ResponseHeader

GetHeaders returns headers for client error response

func (ClientErrorException) GetMessage added in v0.1.3

func (e ClientErrorException) GetMessage() string

GetMessage returns exception end user readable Message

func (ClientErrorException) GetPayload added in v0.1.3

func (e ClientErrorException) GetPayload() api.Payload

GetPayload returns payload of client error response

func (ClientErrorException) GetStatus added in v0.1.3

func (e ClientErrorException) GetStatus() http.StatusCode

GetStatus returns http status code

type ClientException added in v0.1.3

type ClientException interface {
	GlobalException

	// GetPayload returns payload of client error response
	GetPayload() api.Payload

	// GetHeaders returns headers for client error response
	GetHeaders() []api.ResponseHeader
}

ClientException is an interface for any client Exceptions

type Exception

type Exception struct {
	// contains filtered or unexported fields
}

Exception is an exception for fatal error happened in runtime

func (Exception) GetCode

func (e Exception) GetCode() string

GetCode returns exception code

func (Exception) GetErrorMessage

func (e Exception) GetErrorMessage() string

GetErrorMessage returns exception error Message

func (Exception) GetMessage

func (e Exception) GetMessage() string

GetMessage returns exception end user readable Message

func (Exception) GetStatus

func (e Exception) GetStatus() http.StatusCode

GetStatus returns http status code

func (Exception) GetTags

func (e Exception) GetTags() map[string]string

GetTags returns list of informational tags for reporting

func (Exception) ShouldReport

func (e Exception) ShouldReport() bool

ShouldReport determine that whether the panic should be reported By default all exceptions returns true for ShouldReport method

type GenericException

type GenericException interface {
	GlobalException

	// GetErrorMessage returns exception error Message
	GetErrorMessage() string

	// ShouldReport determine that whether the panic should be reported
	ShouldReport() bool

	// GetTags returns list of informational tags for reporting
	GetTags() map[string]string
}

GenericException is an interface for any server Exceptions

type GlobalException added in v0.1.3

type GlobalException interface {
	// GetCode returns exception code
	GetCode() string

	// GetStatus returns http status code
	GetStatus() http.StatusCode

	// GetMessage returns exception end user readable Message
	GetMessage() string
}

GlobalException is an interface for any type of Exceptions

type RoutineException

type RoutineException struct {
	Message     string
	RoutineName string
	Critical    bool
}

RoutineException is an exception that happened in routines

type ValidationException

type ValidationException struct {
	Exception
	// contains filtered or unexported fields
}

ValidationException is an exception for validation errors

func (ValidationException) GetErrors

func (e ValidationException) GetErrors() map[string][]string

GetErrors return validation faults map

Jump to

Keyboard shortcuts

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