Documentation ¶
Index ¶
- Variables
- func Cause(err error) error
- func CustomError(c *gin.Context, httpStatusCode int, msg string, errorCode string)
- func CustomErrorJSON(c *gin.Context, httpStatusCode int, errJSON map[string]interface{})
- func CustomErrorSentry(c *gin.Context, httpStatusCode int, msg string, err error, errorCode string)
- func Recovery(c *gin.Context, httpStatusCode int)
- func RecoveryNoResponse()
- func ReportToSentry(c *gin.Context, err error)
- func StackTrace(err error) string
- func Wrap(err error) error
- type MiddlewareError
Constants ¶
This section is empty.
Variables ¶
var NoEligibilityError = MiddlewareError{
"FLM601",
"No data to compute loan eligibility for user.",
}
NoEligibilityError User is not eligible for loan
Functions ¶
func Cause ¶
Cause returns the original error of a traceable error If the error is not traceable, it returns itself
func CustomError ¶
CustomError returns an error message without reporting to sentry
func CustomErrorJSON ¶
CustomErrorJSON returns a JSON without reporting to sentry
func CustomErrorSentry ¶
CustomErrorSentry returns an error message after reporting to sentry (if environment is not local)
func Recovery ¶
Recovery handles the panic happening on any function, this is to be called by defer in functions
func RecoveryNoResponse ¶
func RecoveryNoResponse()
RecoveryNoResponse handles the panic happening on any function, this is to be called by defer in functions
func ReportToSentry ¶
func StackTrace ¶
StackTrace returns the stack trace with given error If the error is not traceable, empty string is returned
Types ¶
type MiddlewareError ¶
type MiddlewareError struct { ErrorCode string `json:"error_code"` ErrorMessage string `json:"error_message"` }
MiddlewareError represet error codes