Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorStack(err error) string
- func Errorf(code string, format string, args ...interface{}) error
- func MissingParameterError(model string, field string) error
- func New(codeparts ...string) error
- func PluginCallError(model string, field string) error
- func PluginDisableError(reason string) error
- func PluginEnableError(reason string) error
- func PluginInstallError(reason string) error
- func PluginMessageError(reason string) error
- func PluginUninstallError(reason string) error
- func PluginUpgradeError(reason string) error
- func PluginUploadError(reason string) error
- func Trace(other error) error
- func TypeMismatchError(value interface{}, expectedTypes ...string) error
- func WithValue(err error, key string, value interface{}) error
- func Wrap(other error, err error) error
- type Err
- type ErrPayload
Constants ¶
View Source
const ( AccessDenied = "AccessDenied" AlreadyExists = "AlreadyExists" AuthFailure = "AuthFailure" BadConfig = "BadConfig" Blocked = "Blocked" ConstraintViolation = "ConstraintViolation" CorruptedData = "CorruptedData" Gone = "Gone" InUse = "InUse" InvalidEnum = "InvalidEnum" InvalidParameter = "InvalidParameter" KeyConflict = "KeyConflict" LimitExceeded = "LimitExceeded" MissingParameter = "MissingParameter" NotFound = "NotFound" SourceDeleted = "SourceDeleted" OK = "OK" Deleted = "Deleted" PermissionDenied = "PermissionDenied" RedisError = "RedisError" ServerError = "ServerError" SQLError = "SQLError" Timeout = "Timeout" TypeMismatch = "TypeMismatch" StatusError = "StatusError" UnexpectedArguments = "UnexpectedArguments" UnknownError = "UnknownError" VerificationFailure = "VerificationFailure" InvalidFileExt = "InvalidFileExt" CallPluginFailure = "CallPluginFailure" PluginAlreadyRunning = "PluginAlreadyRunning" PluginAlreadyStop = "PluginAlreadyStop" GetPluginMessageFailure = "GetPluginMessageFailure" PluginInstanceInstallationFailure = "PluginInstanceInstallationFailure" PluginInstanceUninstallationFailure = "PluginInstanceUninstallationFailure" PluginInstanceUploadFailure = "PluginInstanceUploadFailure" PluginInstanceEnableFailure = "PluginInstanceEnableFailure" PluginInstanceDisableFailure = "PluginInstanceDisableFailure" PluginInstanceUpgradeFailure = "PluginInstanceUpgradeFailure" PluginInstanceInternalError = "PluginInstanceInternalError" )
View Source
const ( // 文件过大 FileTooLarge = "FileTooLarge" // 文件上传失败 FileUploadFailed = "FileUploadFailed" // 文件格式不正确 FileMalformed = "FileMalformed" // 文件解压失败 FileUnzipFailed = "FileUnzipFailed" // 加载配置文件失败 LoadYamlConfigFailed = "LoadYamlConfig" // 文件元数据错误 ErrorMetaData = "ErrorMetaData" // 保存到数据库失败 SaveToDBFailed = "SaveToDBFailed" // 插件文件不存在 FileNoExist = "FileNoExist" // 插件包已存在 FileAlreadyExist = "FileAlreadyExist" // 未找到该实例 InstanceNotFound = "InstanceNotFound" // 未找到Host HostNotFound = "HostNotFound" // 未找到package PackageNotFound = "PackageNotFound" // 语言不一致 LanguageDisMatch = "LanguageDisMatch" // 语言版本不一致 LanguageVersionDisMatch = "LanguageVersionDisMatch" // Host语言版本不一致 HostLanguageVersionDisMatch = "HostLanguageVersionDisMatch" // 已经卸载 PluginAlreadyUninstall = "PluginAlreadyUninstall" // 插件已安装 PluginAlreadyInstall = "PluginAlreadyInstall" // 插件配置文件解析失败 PluginConfigFileParseFailed = "PluginConfigFileParseFailed" // 插件接口调用失败 CallPluginFailed = "CallPluginFailed" )
View Source
const ( InstanceUUID = "instance_uuid" AppUUID = "app_uuid" AppVersion = "app_version" )
Variables ¶
View Source
var ( DefaultStatusCodeBinding = map[string]int{ AccessDenied: http.StatusForbidden, AlreadyExists: http.StatusConflict, StatusError: http.StatusConflict, AuthFailure: http.StatusUnauthorized, BadConfig: http.StatusInternalServerError, Blocked: http.StatusForbidden, ConstraintViolation: http.StatusForbidden, CorruptedData: http.StatusInternalServerError, Gone: http.StatusGone, InUse: http.StatusBadRequest, InvalidEnum: http.StatusInternalServerError, InvalidParameter: http.StatusBadRequest, KeyConflict: http.StatusInternalServerError, LimitExceeded: http.StatusForbidden, MissingParameter: http.StatusBadRequest, NotFound: http.StatusNotFound, Deleted: http.StatusInternalServerError, SourceDeleted: http.StatusInternalServerError, OK: http.StatusOK, PermissionDenied: http.StatusForbidden, RedisError: http.StatusInternalServerError, ServerError: http.StatusInternalServerError, SQLError: http.StatusInternalServerError, Timeout: http.StatusBadRequest, TypeMismatch: http.StatusInternalServerError, UnexpectedArguments: http.StatusInternalServerError, UnknownError: http.StatusInternalServerError, VerificationFailure: http.StatusBadRequest, InvalidFileExt: http.StatusBadRequest, CallPluginFailure: http.StatusBadRequest, PluginAlreadyRunning: http.StatusBadRequest, PluginAlreadyStop: http.StatusBadRequest, GetPluginMessageFailure: http.StatusBadRequest, PluginInstanceInstallationFailure: http.StatusBadRequest, PluginInstanceUninstallationFailure: http.StatusBadRequest, PluginInstanceUploadFailure: http.StatusBadRequest, PluginInstanceEnableFailure: http.StatusBadRequest, PluginInstanceDisableFailure: http.StatusBadRequest, PluginInstanceUpgradeFailure: http.StatusBadRequest, PluginInstanceInternalError: http.StatusInternalServerError, } )
Functions ¶
func ErrorStack ¶
func MissingParameterError ¶
func PluginCallError ¶
func PluginDisableError ¶
func PluginEnableError ¶
func PluginInstallError ¶
func PluginMessageError ¶
func PluginUninstallError ¶
func PluginUpgradeError ¶
func PluginUploadError ¶
func Trace ¶
从里向外原样返回错误时,必须调用这个方法,以记录里层错误的栈信息 ex:
if err := SomeFunc(); err != nil { return errors.Trace(err) }
func TypeMismatchError ¶
生成 TypeMismatch 错误
Types ¶
type Err ¶
type Err struct { *jujuerrors.Err Code string // contains filtered or unexported fields }
type ErrPayload ¶
func NewErrPayload ¶
func NewErrPayload(err error) *ErrPayload
func (*ErrPayload) MarshalJSON ¶
func (p *ErrPayload) MarshalJSON() ([]byte, error)
func (*ErrPayload) UnmarshalJSON ¶
func (p *ErrPayload) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.