forked from golang/hotime
28 lines
377 B
Go
28 lines
377 B
Go
|
package common
|
||
|
|
||
|
import (
|
||
|
"github.com/sirupsen/logrus"
|
||
|
)
|
||
|
|
||
|
// Error 框架层处理错误
|
||
|
type Error struct {
|
||
|
Logger *logrus.Logger
|
||
|
error
|
||
|
}
|
||
|
|
||
|
func (that *Error) GetError() error {
|
||
|
|
||
|
return that.error
|
||
|
|
||
|
}
|
||
|
|
||
|
func (that *Error) SetError(err error) {
|
||
|
that.error = err
|
||
|
if that.Logger != nil && err != nil {
|
||
|
//that.Logger=log.GetLog("",false)
|
||
|
that.Logger.Warn(err)
|
||
|
}
|
||
|
|
||
|
return
|
||
|
}
|