2021-04-08 21:20:30 +00:00
|
|
|
package observatory
|
|
|
|
|
|
|
|
import "github.com/xtls/xray-core/common/errors"
|
|
|
|
|
|
|
|
type errorCollector struct {
|
|
|
|
errors *errors.Error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *errorCollector) SubmitError(err error) {
|
|
|
|
if e.errors == nil {
|
2024-06-29 18:32:57 +00:00
|
|
|
e.errors = errors.New("underlying connection error").Base(err)
|
2021-04-08 21:20:30 +00:00
|
|
|
return
|
|
|
|
}
|
2024-06-29 18:32:57 +00:00
|
|
|
e.errors = e.errors.Base(errors.New("underlying connection error").Base(err))
|
2021-04-08 21:20:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func newErrorCollector() *errorCollector {
|
|
|
|
return &errorCollector{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *errorCollector) UnderlyingError() error {
|
|
|
|
if e.errors == nil {
|
2024-06-29 18:32:57 +00:00
|
|
|
return errors.New("failed to produce report")
|
2021-04-08 21:20:30 +00:00
|
|
|
}
|
|
|
|
return e.errors
|
|
|
|
}
|