rts-sim-module/modelrepo/error_record.go

26 lines
423 B
Go
Raw Normal View History

package modelrepo
2023-12-27 09:15:26 +08:00
// 构建错误记录
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)
}