Skip to content

Commit

Permalink
fix(ooniprobe): Measure returns EITHER measurement OR error now (ooni…
Browse files Browse the repository at this point in the history
…#544)

See ooni/probe#1816

This diff addresses the most immediate issue but there is probably
extra work to do, including testing and making sure experiments
do not return an error when they should not.
  • Loading branch information
bassosimone authored Oct 14, 2021
1 parent d511c9a commit 3f1bb43
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/ooniprobe/internal/nettests/nettests.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ func (c *Controller) Run(builder *engine.ExperimentBuilder, inputs []string) err
if err := c.msmts[idx64].Failed(c.Probe.DB(), err.Error()); err != nil {
return errors.Wrap(err, "failed to mark measurement as failed")
}
// Even with a failed measurement, we want to continue. We want to
// record and submit the information we have. Saving the information
// is useful for local inspection. Submitting it is useful to us to
// understand what went wrong (censorship? bug? anomaly?).
// Since https://github.com/ooni/probe-cli/pull/527, the Measure
// function returns EITHER a valid measurement OR an error. Before
// that, instead, the measurement was valid EVEN in case of an
// error, which is quite not the <value> OR <error> semantics that
// is so typical and widespread in the Go ecosystem. So, we must
// jump to the next iteration of the loop here rather than falling
// through and attempting to do something with the measurement.
continue
}

saveToDisk := true
Expand Down

0 comments on commit 3f1bb43

Please sign in to comment.