exceptions

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exception

type Exception struct {
	*exception.Service `json:"-"`
	Code               int    `json:"code"`
	Msg                string `json:"msg"`
	Data               any    `json:"data"`
}

Exception 异常响应体

func (*Exception) BadRequest

func (e *Exception) BadRequest(args ...any) services.Exception

BadRequest 400 通用异常请求

func (*Exception) Error

func (e *Exception) Error() string

通用错误方法

func (*Exception) Forbidden

func (e *Exception) Forbidden(args ...any) services.Exception

Forbidden 403 请求禁止

func (*Exception) Get

func (e *Exception) Get(field string) (any, error)

Get 获取内容

func (*Exception) MethodNotAllowed

func (e *Exception) MethodNotAllowed(args ...any) services.Exception

MethodNotAllowed 405 请求方法不可行

func (*Exception) New

func (e *Exception) New(code int, args ...any) services.Exception

New 创建异常

func (*Exception) NotAcceptable

func (e *Exception) NotAcceptable(args ...any) services.Exception

NotAcceptable 406 不可接受的请求

func (*Exception) NotFound

func (e *Exception) NotFound(args ...any) services.Exception

NotFound 404 没有找到请求的资源

func (*Exception) RequestEntityTooLarge

func (e *Exception) RequestEntityTooLarge(args ...any) services.Exception

RequestEntityTooLarge 413 请求实体太大

func (*Exception) RequestTimeout

func (e *Exception) RequestTimeout(args ...any) services.Exception

RequestTimeout 408 请求超时

func (*Exception) RequestURITooLong

func (e *Exception) RequestURITooLong(args ...any) services.Exception

RequestURITooLong 414 请求 URL 太长

func (*Exception) Set

func (e *Exception) Set(arg any) services.Exception

Set 通用设置内容

func (*Exception) TooManyRequests

func (e *Exception) TooManyRequests(args ...any) services.Exception

TooManyRequests 429 过多的请求

func (*Exception) Unauthorized

func (e *Exception) Unauthorized(args ...any) services.Exception

Unauthorized 401 未授权的请求

func (*Exception) UnprocessableEntity

func (e *Exception) UnprocessableEntity(args ...any) services.Exception

UnprocessableEntity 422 请求参数错误

func (*Exception) UnsupportedMediaType

func (e *Exception) UnsupportedMediaType(args ...any) services.Exception

UnsupportedMediaType 415 请求内容类型不接受

Jump to

Keyboard shortcuts

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