hotime/error.go

40 lines
480 B
Go
Raw Normal View History

2017-08-04 08:20:59 +00:00
package hotime
import "fmt"
//框架层处理错误
type Error struct {
err error
}
func(this *Error)GetError()error{
return this.err
}
2017-08-16 09:15:51 +00:00
func(this *Error)SetError(err error,loglevel ...int){
2017-08-04 08:20:59 +00:00
2017-09-05 01:42:04 +00:00
SafeMutex(MUTEX_HOTIME_SYSTEM_ERR, func() interface{} {
2017-08-16 09:15:51 +00:00
this.err=nil
2017-08-04 08:20:59 +00:00
if err==nil{
this.err=err
return nil
}
2017-10-24 14:53:22 +00:00
lev:=Config.GetInt("LOG_NIL")
2017-08-04 08:20:59 +00:00
if len(loglevel)!=0{
lev=loglevel[0]
}
if lev==LOG_FMT{
fmt.Println(err)
}
this.err=err
return nil
})
}