refactor(errorsx): directly return ErrWrapper when needed

The utility of SafeErrWrapperBuilder is low. Let us instead change the
code to always create ErrWrapper when we're in this package.

While there, also note some TODO-next items.

Part of https://github.com/ooni/probe/issues/1505.
This commit is contained in:
Simone Basso 2021-07-02 14:00:46 +02:00
commit b9ff9136e2
3 changed files with 188 additions and 69 deletions

View file

@ -105,6 +105,8 @@ func toFailureString(err error) string {
// The list returned here matches the values used by MK unless
// explicitly noted otherwise with a comment.
// TODO(bassosimone): we need to always apply this rule not only here
// when we're making the most generic conversion.
var errwrapper *ErrWrapper
if errors.As(err, &errwrapper) {
return errwrapper.Error() // we've already wrapped it