err

package
v0.0.0-...-599ae38 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

* Copyright FMR LLC <opensource@fidelity.com> * * SPDX-License-Identifier: Apache

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStatusCode

func GetStatusCode(err error) int

If CommonError and Kind is DB/Cloud/Log/K8s, return 503. Else return 500.

func NewCommonError

func NewCommonError(ctx context.Context, kind ErrorType, msg string) error

New CommonError function, will log error message and stacktrace.

func PanicHandler

func PanicHandler(next http.Handler) http.Handler

Used as middleware, to catch unhandled Panic Return error message, Http status 500.

Types

type CommonError

type CommonError struct {
	Kind    ErrorType `json:"kind"`
	Message string    `json:"message"`
}

Customised Error, with Kind

func (CommonError) Error

func (c CommonError) Error() string

func (CommonError) ErrorMsg

func (c CommonError) ErrorMsg() string

type ErrorType

type ErrorType uint8
const (
	COMMON ErrorType = iota
	CONFIGURATION
	DATABASE
	LOGSERVER
	KUBERNETES
	CLOUD
	PROMETHEUS
	API
)

func (ErrorType) String

func (s ErrorType) String() string

Jump to

Keyboard shortcuts

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