Documentation ¶
Index ¶
- Constants
- func CodeText(code int) string
- type Mo2Errors
- func (e Mo2Errors) Error() string
- func (e *Mo2Errors) Init(c int, format string, a ...interface{})
- func (e *Mo2Errors) InitCode(c int)
- func (e *Mo2Errors) InitError(err error)
- func (e *Mo2Errors) InitNoError(format string, a ...interface{})
- func (e Mo2Errors) IsError() (error bool)
- func (e *Mo2Errors) SetErrorTip(s string)
Examples ¶
Constants ¶
View Source
const ( Mo2NoError = 200 Mo2NoExist = 400 Mo2NotFound = 404 Mo2Conflict = 409 Mo2LengthRequired = 411 Mo2Error = 418 Mo2NoLogin = 420 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mo2Errors ¶
Mo2Errors standard mo2 err
func InitNoError ¶
InitNoError init with no error tips
func New ¶
New returns an error that formats as the given text. Each call to New returns a distinct error value even if the text is identical.
Example ¶
package main import ( "fmt" "github.com/Monkey-Mouse/mo2/mo2utils/mo2errors" ) func main() { err := mo2errors.New(mo2errors.Mo2LengthRequired, "abc") if err != nil { fmt.Print(err) } }
Output: 411: abc
func NewCode ¶
NewCode returns an error that formats as the given text. Each call to New returns a distinct error value even if the text is identical.
Example ¶
package main import ( "fmt" "github.com/Monkey-Mouse/mo2/mo2utils/mo2errors" ) func main() { err := mo2errors.NewCode(mo2errors.Mo2LengthRequired) if err != nil { fmt.Print(err) } }
Output: 411: length not match required
func (*Mo2Errors) InitNoError ¶
InitNoError init with no error tips
Click to show internal directories.
Click to hide internal directories.