rts-sim-module/cgrepo/error_record.go

26 lines
418 B
Go
Raw Normal View History

2023-12-27 09:15:26 +08:00
package repo
// 构建错误记录
type ErrorRecord struct {
// 告警信息
Warns []string
// 错误信息
Errs []string
}
func NewErrorRecord() *ErrorRecord {
return &ErrorRecord{}
}
func (r *ErrorRecord) AddError(err string) {
r.Errs = append(r.Errs, err)
}
func (r *ErrorRecord) HasError() bool {
return len(r.Errs) > 0
}
func (r *ErrorRecord) AddWarn(warn string) {
r.Warns = append(r.Warns, warn)
}