2021-05-23 23:27:41 +00:00
|
|
|
package common
|
2017-08-04 08:20:59 +00:00
|
|
|
|
|
|
|
//框架层处理错误
|
|
|
|
type Error struct {
|
2020-02-21 16:13:41 +00:00
|
|
|
error
|
2017-08-04 08:20:59 +00:00
|
|
|
err error
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:20:56 +00:00
|
|
|
func (this *Error) GetError() error {
|
2017-08-04 08:20:59 +00:00
|
|
|
|
2020-02-21 16:13:41 +00:00
|
|
|
return this.error
|
2017-08-04 08:20:59 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:20:56 +00:00
|
|
|
func (this *Error) SetError(err error, loglevel ...int) {
|
2017-08-04 08:20:59 +00:00
|
|
|
|
2020-02-21 16:13:41 +00:00
|
|
|
this.error = nil
|
2020-02-20 06:20:56 +00:00
|
|
|
if err == nil {
|
2020-02-21 16:13:41 +00:00
|
|
|
this.error = err
|
2020-02-20 06:20:56 +00:00
|
|
|
this.err = err
|
2018-04-03 17:54:27 +00:00
|
|
|
return
|
2020-02-20 06:20:56 +00:00
|
|
|
}
|
2020-02-21 16:13:41 +00:00
|
|
|
this.error = err
|
2020-02-20 06:20:56 +00:00
|
|
|
return
|
2017-08-04 08:20:59 +00:00
|
|
|
}
|