github.com/xmplusdev/xmcore@v1.8.11-0.20240412132628-5518b55526af/app/observatory/explainErrors.go (about) 1 package observatory 2 3 import "github.com/xmplusdev/xmcore/common/errors" 4 5 type errorCollector struct { 6 errors *errors.Error 7 } 8 9 func (e *errorCollector) SubmitError(err error) { 10 if e.errors == nil { 11 e.errors = newError("underlying connection error").Base(err) 12 return 13 } 14 e.errors = e.errors.Base(newError("underlying connection error").Base(err)) 15 } 16 17 func newErrorCollector() *errorCollector { 18 return &errorCollector{} 19 } 20 21 func (e *errorCollector) UnderlyingError() error { 22 if e.errors == nil { 23 return newError("failed to produce report") 24 } 25 return e.errors 26 }