2021-03-07 07:14:58 -05:00
|
|
|
package observatory
|
|
|
|
|
2022-01-02 10:16:23 -05:00
|
|
|
import "github.com/v2fly/v2ray-core/v5/common/errors"
|
2021-03-07 07:14:58 -05:00
|
|
|
|
|
|
|
type errorCollector struct {
|
|
|
|
errors *errors.Error
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *errorCollector) SubmitError(err error) {
|
|
|
|
if e.errors == nil {
|
|
|
|
e.errors = newError("underlying connection error").Base(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
e.errors = e.errors.Base(newError("underlying connection error").Base(err))
|
|
|
|
}
|
|
|
|
|
|
|
|
func newErrorCollector() *errorCollector {
|
|
|
|
return &errorCollector{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *errorCollector) UnderlyingError() error {
|
|
|
|
if e.errors == nil {
|
|
|
|
return newError("failed to produce report")
|
|
|
|
}
|
|
|
|
return e.errors
|
|
|
|
}
|