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
commit 72acd175a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 287 additions and 287 deletions

View file

@ -18,8 +18,8 @@ import (
"github.com/ooni/probe-cli/v3/internal/engine/geolocate"
"github.com/ooni/probe-cli/v3/internal/engine/model"
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/trace"
"github.com/ooni/probe-cli/v3/internal/errorsx"
)
// ExtSpec describes a data format extension
@ -80,7 +80,7 @@ type TCPConnectEntry struct {
func NewTCPConnectList(begin time.Time, events []trace.Event) []TCPConnectEntry {
var out []TCPConnectEntry
for _, event := range events {
if event.Name != errorx.ConnectOperation {
if event.Name != errorsx.ConnectOperation {
continue
}
if event.Proto != "tcp" {
@ -110,11 +110,11 @@ func NewFailure(err error) *string {
// The following code guarantees that the error is always wrapped even
// when we could not actually hit our code that does the wrapping. A case
// in which this happen is with context deadline for HTTP.
err = errorx.SafeErrWrapperBuilder{
err = errorsx.SafeErrWrapperBuilder{
Error: err,
Operation: errorx.TopLevelOperation,
Operation: errorsx.TopLevelOperation,
}.MaybeBuild()
errWrapper := err.(*errorx.ErrWrapper)
errWrapper := err.(*errorsx.ErrWrapper)
s := errWrapper.Failure
if s == "" {
s = "unknown_failure: errWrapper.Failure is empty"
@ -128,8 +128,8 @@ func NewFailedOperation(err error) *string {
return nil
}
var (
errWrapper *errorx.ErrWrapper
s = errorx.UnknownOperation
errWrapper *errorsx.ErrWrapper
s = errorsx.UnknownOperation
)
if errors.As(err, &errWrapper) && errWrapper.Operation != "" {
s = errWrapper.Operation
@ -474,7 +474,7 @@ type NetworkEvent struct {
func NewNetworkEventsList(begin time.Time, events []trace.Event) []NetworkEvent {
var out []NetworkEvent
for _, ev := range events {
if ev.Name == errorx.ConnectOperation {
if ev.Name == errorsx.ConnectOperation {
out = append(out, NetworkEvent{
Address: ev.Address,
Failure: NewFailure(ev.Err),
@ -484,7 +484,7 @@ func NewNetworkEventsList(begin time.Time, events []trace.Event) []NetworkEvent
})
continue
}
if ev.Name == errorx.ReadOperation {
if ev.Name == errorsx.ReadOperation {
out = append(out, NetworkEvent{
Failure: NewFailure(ev.Err),
Operation: ev.Name,
@ -493,7 +493,7 @@ func NewNetworkEventsList(begin time.Time, events []trace.Event) []NetworkEvent
})
continue
}
if ev.Name == errorx.WriteOperation {
if ev.Name == errorsx.WriteOperation {
out = append(out, NetworkEvent{
Failure: NewFailure(ev.Err),
Operation: ev.Name,
@ -502,7 +502,7 @@ func NewNetworkEventsList(begin time.Time, events []trace.Event) []NetworkEvent
})
continue
}
if ev.Name == errorx.ReadFromOperation {
if ev.Name == errorsx.ReadFromOperation {
out = append(out, NetworkEvent{
Address: ev.Address,
Failure: NewFailure(ev.Err),
@ -512,7 +512,7 @@ func NewNetworkEventsList(begin time.Time, events []trace.Event) []NetworkEvent
})
continue
}
if ev.Name == errorx.WriteToOperation {
if ev.Name == errorsx.WriteToOperation {
out = append(out, NetworkEvent{
Address: ev.Address,
Failure: NewFailure(ev.Err),