agcodes

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// No error code specified.
	CodeNil = newLocalCoder("CodeNil", "未指定错误码", "", "")
	// It is OK.
	CodeOK = newLocalCoder("OK", "OK", "", "")
	// An error occurred internally.
	CodeInternalError = newLocalCoder("Public.InternalError",
		"服务 [serviceName] 内部错误。", "", "")

	// Unknown error.
	CodeUnknown = newLocalCoder("Public.UnknownError",
		"服务 [serviceName] 内部出现未知错误。", "", "")

	CodeInvalidParameter = newLocalCoder("Public.InvalidParameter", "调用服务 [serviceName] 接口 [interfaceName] 参数值 [params] 校验不通过。", "", "请使用请求参数构造规范化的请求字符串。详细信息参见产品 API 文档。")

	// The given parameter for current operation is invalid.
	CodeMissingParameter = newLocalCoder("Public.MissingParameter", "调用服务 [serviceName] 接口 [interfaceName] 缺少必须参数 [params] 。", "", "请检查调用时是否填写了此参数,并重试请求。详细信息参见产品 API 文档。")

	CodeUnsupportedHTTPMethod = newLocalCoder("Public.UnsupportedHTTPMethod", "服务 [serviceName] 未提供 HTTP 接口 [interfaceName] 支持。", "", "建议查看产品 API 文档。")

	CodeServiceUnavailable = newLocalCoder("Public.ServiceUnavailableDuringUpgrade", "服务 [serviceName] 暂时不可用。", "系统正在升级,暂时不可用。", "请稍后尝试。")

	CodeNotFound = newLocalCoder("Public.NotFound", "Not Found", "", "") // Resource does not exist.

	CodeNotAuthorized = newLocalCoder("Public.NotAuthorized", "Not Authorized", "", "") // Not Authorized.

	NotAuthentication     = newLocalCoder("Public.NotAuthentication", "无用户登录信息", "", "")
	HydraException        = newLocalCoder("Public.HydraException", "授权服务异常", "", "")
	AuthenticationFailure = newLocalCoder("Public.AuthenticationFailure", "用户登录已过期", "", "")
	GetUserInfoFailure    = newLocalCoder("Public.GetUserInfoFailure", "获取用户信息失败", "", "")
	AuthorizationFailure  = newLocalCoder("Public.AuthorizationFailure", "暂无权限,您可联系系统管理员配置", "", "")
	AccessTypeNotSupport  = newLocalCoder("Public.AccessTypeNotSupport", "暂不支持的访问类型", "", "")
)

Functions

This section is empty.

Types

type Coder

type Coder interface {
	GetErrorCode() string
	GetDescription() string
	GetCause() string
	GetSolution() string
	GetErrorDetails() interface{}
	GetErrorLink() string
}

func New

func New(errorCode, description, cause, solution string, detail interface{}, errLink string) Coder

New creates and returns an error code.

func WithCode

func WithCode(code Coder, detail interface{}) Coder

WithCode creates and returns a new error code based on given Code.

Jump to

Keyboard shortcuts

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