refactor: split errorsx in good and legacy (#477)
The legacy part for now is internal/errorsx. It will stay there until I figure out whether it also needs some extra bug fixing. The good part is now in internal/netxlite/errorsx and contains all the logic for mapping errors. We need to further improve upon this logic by writing more thorough integration tests for QUIC. We also need to copy the various dialer, conn, etc adapters that set errors. We will put them inside netxlite and we will generate errors in a way that is less crazy with respect to the major operation. (The idea is to always wrap, given that now we measure in an incremental way and we don't measure every operation together.) Part of https://github.com/ooni/probe/issues/1591
This commit is contained in:
@@ -12,7 +12,8 @@ import (
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/atomicx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/modelx"
|
||||
"github.com/ooni/probe-cli/v3/internal/errorsx"
|
||||
errorsxlegacy "github.com/ooni/probe-cli/v3/internal/errorsx"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite/errorsx"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite/iox"
|
||||
)
|
||||
|
||||
@@ -116,7 +117,7 @@ func (t *TraceTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
TLSHandshakeDone: func(state tls.ConnectionState, err error) {
|
||||
// Wrapping the error even if we're not returning it because it may
|
||||
// less confusing to users to see the wrapped name
|
||||
err = errorsx.SafeErrWrapperBuilder{
|
||||
err = errorsxlegacy.SafeErrWrapperBuilder{
|
||||
Error: err,
|
||||
Operation: errorsx.TLSHandshakeOperation,
|
||||
}.MaybeBuild()
|
||||
@@ -171,7 +172,7 @@ func (t *TraceTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
WroteRequest: func(info httptrace.WroteRequestInfo) {
|
||||
// Wrapping the error even if we're not returning it because it may
|
||||
// less confusing to users to see the wrapped name
|
||||
err := errorsx.SafeErrWrapperBuilder{
|
||||
err := errorsxlegacy.SafeErrWrapperBuilder{
|
||||
Error: info.Err,
|
||||
Operation: errorsx.HTTPRoundTripOperation,
|
||||
}.MaybeBuild()
|
||||
@@ -207,7 +208,7 @@ func (t *TraceTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
}
|
||||
|
||||
resp, err := t.roundTripper.RoundTrip(req)
|
||||
err = errorsx.SafeErrWrapperBuilder{
|
||||
err = errorsxlegacy.SafeErrWrapperBuilder{
|
||||
Error: err,
|
||||
Operation: majorOp,
|
||||
}.MaybeBuild()
|
||||
|
||||
Reference in New Issue
Block a user