2021-05-23 23:27:41 +00:00
|
|
|
package common
|
2017-08-04 08:20:59 +00:00
|
|
|
|
2021-05-25 11:53:34 +00:00
|
|
|
import (
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2021-05-24 21:08:17 +00:00
|
|
|
// Error 框架层处理错误
|
2017-08-04 08:20:59 +00:00
|
|
|
type Error struct {
|
2021-05-28 14:52:22 +00:00
|
|
|
Logger *logrus.Logger
|
2020-02-21 16:13:41 +00:00
|
|
|
error
|
2017-08-04 08:20:59 +00:00
|
|
|
}
|
|
|
|
|
2021-05-24 21:08:17 +00:00
|
|
|
func (that *Error) GetError() error {
|
2017-08-04 08:20:59 +00:00
|
|
|
|
2021-05-24 21:08:17 +00:00
|
|
|
return that.error
|
2017-08-04 08:20:59 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-05-24 21:08:17 +00:00
|
|
|
func (that *Error) SetError(err error) {
|
|
|
|
that.error = err
|
2021-05-25 12:27:24 +00:00
|
|
|
if that.Logger != nil && err != nil {
|
2021-05-25 11:53:34 +00:00
|
|
|
//that.Logger=log.GetLog("",false)
|
|
|
|
that.Logger.Warn(err)
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:20:56 +00:00
|
|
|
return
|
2017-08-04 08:20:59 +00:00
|
|
|
}
|