Documentation ¶
Index ¶
- Variables
- func CatchCheckError()
- func CheckError(err error)
- func CheckError2(v interface{}, err error) *gvalue.AnyValue
- func CheckError3(v1 interface{}, v2 interface{}, err error) (*gvalue.AnyValue, *gvalue.AnyValue)
- func IsWaitTimeoutErr(e error) bool
- func Recover(f func(gcore.Error))
- func Wait(f func()) <-chan error
- func WaitTimeout(f func(), timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //SafetyCall call func f, and returned recover() error or nil SafetyCall = gerror.Try //SafetyCallError call func f, and wrap recover() error to gcore.Error, or nil returned SafetyCallError = gerror.TryWithStack //RecoverNop call recover() and do nothing RecoverNop = gerror.RecoverNop //RecoverNopAndFunc call recover() and then call the f RecoverNopAndFunc = gerror.RecoverNopFunc )
Functions ¶
func CatchCheckError ¶
func CatchCheckError()
CatchCheckError catch the panic error throwing by CheckError. If func have another defer to catch recover(), put the defer before defer CatchCheckError. For example:
func myFunc() (err error) { defer func() { e := recover() if e != nil { err = fmt.Errorf("%s", e) } }() defer CatchCheckError() panic("abc") }
func CheckError ¶
func CheckError(err error)
CheckError if err is not nil, the func call will return immediately at CheckError call. this should be worked with defer CatchCheckError()
func CheckError2 ¶
CheckError2 check the err and return the value if err is nil
func CheckError3 ¶
CheckError3 check the err and return the value if err is nil
func IsWaitTimeoutErr ¶
func WaitTimeout ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.