refactor: move i/e/n/errorx to i/errorsx (#416)

Still working towards https://github.com/ooni/probe/issues/1505
This commit is contained in:
Simone Basso
2021-07-01 16:34:36 +02:00
committed by GitHub
parent 6895946a34
commit 72acd175a0
58 changed files with 287 additions and 287 deletions
+2 -2
View File
@@ -9,9 +9,9 @@ import (
"time"
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/tlsdialer"
"github.com/ooni/probe-cli/v3/internal/engine/netx/trace"
"github.com/ooni/probe-cli/v3/internal/errorsx"
"github.com/ooni/probe-cli/v3/internal/netxlite"
)
@@ -69,7 +69,7 @@ func TestSaverTLSHandshakerSuccessWithReadWrite(t *testing.T) {
t.Fatal("unexpected NumBytes")
}
switch ev[idx].Name {
case errorx.ReadOperation, errorx.WriteOperation:
case errorsx.ReadOperation, errorsx.WriteOperation:
default:
t.Fatal("unexpected Name")
}
+4 -4
View File
@@ -8,7 +8,7 @@ import (
"time"
"github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/modelx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/errorsx"
)
// UnderlyingDialer is the underlying dialer type.
@@ -32,10 +32,10 @@ func (h ErrorWrapperTLSHandshaker) Handshake(
ctx context.Context, conn net.Conn, config *tls.Config,
) (net.Conn, tls.ConnectionState, error) {
tlsconn, state, err := h.TLSHandshaker.Handshake(ctx, conn, config)
err = errorx.SafeErrWrapperBuilder{
Classifier: errorx.ClassifyTLSFailure,
err = errorsx.SafeErrWrapperBuilder{
Classifier: errorsx.ClassifyTLSFailure,
Error: err,
Operation: errorx.TLSHandshakeOperation,
Operation: errorsx.TLSHandshakeOperation,
}.MaybeBuild()
return tlsconn, state, err
}
+4 -4
View File
@@ -10,8 +10,8 @@ import (
"github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/handlers"
"github.com/ooni/probe-cli/v3/internal/engine/legacy/netx/modelx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/tlsdialer"
"github.com/ooni/probe-cli/v3/internal/errorsx"
"github.com/ooni/probe-cli/v3/internal/netxlite"
)
@@ -48,14 +48,14 @@ func TestErrorWrapperTLSHandshakerFailure(t *testing.T) {
if conn != nil {
t.Fatal("expected nil con here")
}
var errWrapper *errorx.ErrWrapper
var errWrapper *errorsx.ErrWrapper
if !errors.As(err, &errWrapper) {
t.Fatal("cannot cast to ErrWrapper")
}
if errWrapper.Failure != errorx.FailureEOFError {
if errWrapper.Failure != errorsx.FailureEOFError {
t.Fatal("unexpected Failure")
}
if errWrapper.Operation != errorx.TLSHandshakeOperation {
if errWrapper.Operation != errorsx.TLSHandshakeOperation {
t.Fatal("unexpected Operation")
}
}