Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Unknown = DefineCode(5000001, "error", "Unknown", fmt.Sprintf(`
Unknown error code. Usually you will see this code in three cases:
1. You forget to define Code or function DefineCode not being executed;
2. This is not Beego's error but you call FromError();
3. Beego got unexpected error and don't know how to handle it, and then return Unknown error
A common practice to DefineCode looks like:
%s
In this way, you may forget to import this package, and got Unknown error.
Sometimes, you believe you got Beego error, but actually you don't, and then you call FromError(err)
`, goCodeBlock(`
import your_package
func init() {
DefineCode(5100100, "your_module", "detail")
// ...
}
`)))
Unknown indicates got some error which is not defined
Functions ¶
Types ¶
type Code ¶
A Code is an unsigned 32-bit error code as defined in the beego spec.
func DefineCode ¶
DefineCode defining a new Code Before defining a new code, please read Beego specification. desc could be markdown doc
Click to show internal directories.
Click to hide internal directories.