core

package
v0.0.0-...-aa074f2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SUCCESS       = 1000
	FAILURE       = 1001
	InternalError = 1002
)

SUCCESS The program met expectations and was successfully processed FAILURE Exception status code captured within the service InternalError Service internal exception, not caught, fatal error code

View Source
const (
	PRINT_ERROR_STACK              = false
	OUTPUT_INTERNAL_ERROR          = true
	ADD_LINK_TRACKING_MIDDLEWARE   = true
	ADD_REQUEST_LOGGING_MIDDLEWARE = true
)

PRINT_ERROR_STACK The exception thrown in the program will print the error stack OUTPUT_INTERNAL_ERROR Uncaptured service internal exception will be returned in the response ADD_LINK_TRACKING_MIDDLEWARE Add request headers middleware ADD_REQUEST_LOGGING_MIDDLEWARE Add request logging middleware

Variables

View Source
var ExceptionsToCatch = []Exception{
	&NoPermissions{},
	&DatabaseFailure{},
}

Functions

func RequestHandler

func RequestHandler() gin.HandlerFunc

RequestHandler 是一个中间件,用于处理请求和响应

Types

type DatabaseFailure

type DatabaseFailure struct {
	Message string
}

func (*DatabaseFailure) Error

func (e *DatabaseFailure) Error() string

type Exception

type Exception interface {
	error
}

type NoPermissions

type NoPermissions struct {
	Message string
}

func (*NoPermissions) Error

func (e *NoPermissions) Error() string

实现 Error 接口,返回错误信息

type UnsupportedDataTypeError

type UnsupportedDataTypeError struct {
	Message string
}

func (*UnsupportedDataTypeError) Error

func (e *UnsupportedDataTypeError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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