Catch

package module
v0.0.0-...-24c34cc Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

README

Catch

Error handling and monitoring service for go

Documentation

Index

Constants

View Source
const FormEncodedHeader = "application/x-www-form-urlencoded; charset=utf-8"
View Source
const JsonByteStreamHeader = "application/json; charset=utf-8"

Variables

This section is empty.

Functions

func HandleKnockout

func HandleKnockout(c *gin.Context, code int, obj IsLogged)

Function to knockout due to an error, sending back the isLogged object (can just be log or full object in itself)

func HandleKnockoutPunch

func HandleKnockoutPunch(c *gin.Context, code int, origin string, punch error)

A knockout punch is a non-rectifiable error persistent to the crt sent ie a formatting issue or such that the we cannot create a rectifier

Types

type Failure

type Failure struct {
	Code      int
	Origin    string
	Message   string
	Fatal     bool
	Rectifier Rectifier
}

func CreateFailureFromError

func CreateFailureFromError(code int, origin string, originError error, isFatal bool, rectifier Rectifier) Failure

type IsLogged

type IsLogged interface {
	GetLog() Log
}

type Log

type Log struct {
	Fatality bool
	Failures []Failure
	Messages []string
}

Log is the high level collection of whats happened Intended to be passed to functions to add failures as nessasary Does not contain debug information for the log etc, as this is handled on fatality Failures on addition can knockout the log causing a fatality FatalityHandler is what handles when this happens, terminating the request and sending log to the service

func (*Log) AddFailure

func (g *Log) AddFailure(fail Failure)

func (*Log) AddNewFailureFromError

func (g *Log) AddNewFailureFromError(code int, origin string, originError error, isFatal bool, rectifier Rectifier)

func (*Log) GetLog

func (g *Log) GetLog() Log

func (*Log) MergeLogs

func (g *Log) MergeLogs(newLog Log)

type Rectifier

type Rectifier struct {
	Rectify      interface{} //this is left interfacial for the purpose of usage elsewhere
	TargetDomain string
	TargetQuery  string
	Method       string
}

func CreateRectifierWithPath

func CreateRectifierWithPath(method string, domain string, path string, query string, req interface{}) Rectifier

Jump to

Keyboard shortcuts

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