Documentation
¶
Overview ¶
Package gcode provides universal error code definition and common error codes implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CodeNil = newLocalCode(-1, "", nil) CodeOK = newLocalCode(0, "OK", nil) CodeInternalError = newLocalCode(50, "Internal Error", nil) CodeValidationFailed = newLocalCode(51, "Validation Failed", nil) CodeDbOperationError = newLocalCode(52, "Database Operation Error", nil) CodeInvalidParameter = newLocalCode(53, "Invalid Parameter", nil) CodeMissingParameter = newLocalCode(54, "Missing Parameter", nil) CodeInvalidOperation = newLocalCode(55, "Invalid Operation", nil) CodeInvalidConfiguration = newLocalCode(56, "Invalid Configuration", nil) CodeMissingConfiguration = newLocalCode(57, "Missing Configuration", nil) CodeNotImplemented = newLocalCode(58, "Not Implemented", nil) CodeNotSupported = newLocalCode(59, "Not Supported", nil) CodeOperationFailed = newLocalCode(60, "Operation Failed", nil) CodeNotAuthorized = newLocalCode(61, "Not Authorized", nil) CodeSecurityReason = newLocalCode(62, "Security Reason", nil) CodeServerBusy = newLocalCode(63, "Server Is Busy", nil) CodeUnknown = newLocalCode(64, "Unknown Error", nil) CodeNotFound = newLocalCode(65, "Not Found", nil) CodeInvalidRequest = newLocalCode(66, "Invalid Request", nil) CodeNecessaryPackageNotImport = newLocalCode(67, "Necessary Package Not Import", nil) CodeInternalPanic = newLocalCode(68, "Internal Panic", nil) CodeBusinessValidationFailed = newLocalCode(300, "Business Validation Failed", nil) )
Common error code definition. There are reserved internal error codes by framework: code < 1000.
Functions ¶
Types ¶
type Code ¶
type Code interface { // Code returns the integer number of current error code. Code() int // Message returns the brief message for current error code. Message() string // Detail returns the detailed information of current error code, // which is mainly designed as an extension field for error code. Detail() interface{} }
Code is universal error code interface definition.
Click to show internal directories.
Click to hide internal directories.