feat(errorsx): introduce NewTopLevelGenericErrWrapper (#511)

Part of https://github.com/ooni/probe/issues/1733 and diff has been
extracted from https://github.com/ooni/probe-cli/pull/506.
This commit is contained in:
Simone Basso 2021-09-27 14:55:47 +02:00 committed by GitHub
commit 201f602a40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -92,3 +92,9 @@ func NewErrWrapper(c Classifier, op string, err error) *ErrWrapper {
WrappedErr: err,
}
}
// NewTopLevelGenericErrWrapper wraps an error occurring at top
// level using the most generic available classifier.
func NewTopLevelGenericErrWrapper(err error) *ErrWrapper {
return NewErrWrapper(ClassifyGenericError, TopLevelOperation, err)
}