2021-04-09 00:20:30 +03: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 21:32:57 +03:00
|
|
|
e.errors = errors.New("underlying connection error").Base(err)
|
2021-04-09 00:20:30 +03:00
|
|
|
return
|
|
|
|
}
|
2024-06-29 21:32:57 +03:00
|
|
|
e.errors = e.errors.Base(errors.New("underlying connection error").Base(err))
|
2021-04-09 00:20:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func newErrorCollector() *errorCollector {
|
|
|
|
return &errorCollector{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *errorCollector) UnderlyingError() error {
|
|
|
|
if e.errors == nil {
|
2024-06-29 21:32:57 +03:00
|
|
|
return errors.New("failed to produce report")
|
2021-04-09 00:20:30 +03:00
|
|
|
}
|
|
|
|
return e.errors
|
|
|
|
}
|