fix: ensure experiments return nil when we want to submit (#654)

Since https://github.com/ooni/probe-cli/pull/527, if an experiment
returns an error, the corresponding measurement is not submitted since
the semantics of returning an error is that something fundamental
went wrong (e.g., we could not parse the input URL).

This diff ensures that all experiments only return and error when
something fundamental was wrong and return nil otherwise.

Reference issue: https://github.com/ooni/probe/issues/1808.
This commit is contained in:
Simone Basso 2022-01-07 13:17:20 +01:00 committed by GitHub
commit 99ec7ffca9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 132 additions and 66 deletions

View file

@ -159,6 +159,9 @@ func (m *Measurer) Run(
return ErrUnsupportedURLScheme
}
// Implementation note: we must not return an error from now now. Returning an
// error means that we don't have a measurement to submit.
// 4. possibly expand a domain to a list of IP addresses.
//
// Implementation note: because the resolver we constructed also deals