cleanup: use ErrorToStringOrOK func in other tests that returns nil (#701)

Reference issue: https://github.com/ooni/probe/issues/2040
This commit is contained in:
Yeganathan S 2022-03-08 16:29:44 +05:30 committed by GitHub
parent 024eb42334
commit 74e31d5cc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -131,7 +131,7 @@ func (m Measurer) Run(
tk.Tampering = (tk.Tampering || result.Tampering)
completed++
percentage := (float64(completed)/float64(len(m.Methods)))*0.5 + 0.5
callbacks.OnProgress(percentage, fmt.Sprintf("%s... %+v", result.Name, result.Err))
callbacks.OnProgress(percentage, fmt.Sprintf("%s... %+v", result.Name, model.ErrorToStringOrOK(result.Err)))
if completed >= len(m.Methods) {
break
}

View File

@ -106,7 +106,7 @@ func (m Multi) collect(expect int, overallStartIndex int, overallCount int, pref
count++
percentage := float64(count) / float64(overallCount)
callbacks.OnProgress(percentage, fmt.Sprintf(
"%s: measure %s: %+v", prefix, entry.Input.Target, entry.Err,
"%s: measure %s: %+v", prefix, entry.Input.Target, model.ErrorToStringOrOK(entry.Err),
))
outputch <- entry
}

View File

@ -64,7 +64,7 @@ func Control(
if err != nil {
err = netxlite.NewTopLevelGenericErrWrapper(err)
}
sess.Logger().Infof("control for %s... %+v", creq.HTTPRequest, err)
sess.Logger().Infof("control for %s... %+v", creq.HTTPRequest, model.ErrorToStringOrOK(err))
(&out.DNS).FillASNs(sess)
return
}

View File

@ -44,7 +44,7 @@ func DNSLookup(ctx context.Context, config DNSLookupConfig) (out DNSLookupResult
}
}
}
config.Session.Logger().Infof("%s... %+v", target, err)
config.Session.Logger().Infof("%s... %+v", target, model.ErrorToStringOrOK(err))
out.Failure = result.Failure
out.TestKeys = result
return

View File

@ -63,7 +63,7 @@ func HTTPGet(ctx context.Context, config HTTPGetConfig) (out HTTPGetResult) {
Session: config.Session,
Target: target,
}.Get(ctx)
config.Session.Logger().Infof("GET %s... %+v", target, err)
config.Session.Logger().Infof("GET %s... %+v", target, model.ErrorToStringOrOK(err))
out.Failure = result.Failure
out.TestKeys = result
return

View File

@ -163,7 +163,7 @@ func (r *Resolver) lookupHost(ctx context.Context, ri *resolverinfo, hostname st
}
addrs, err := r.timeLimitedLookup(ctx, re, hostname)
if err == nil {
r.logger().Infof("sessionresolver: %s... %v", ri.URL, nil)
r.logger().Infof("sessionresolver: %s... %v", ri.URL, model.ErrorToStringOrOK(nil))
ri.Score = ewma*1.0 + (1-ewma)*ri.Score // increase score
return addrs, nil
}