diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-11 09:36:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-11 09:36:53 -0400 |
commit | 8f0a53c974cdaebb4cb46e04e27d3c3204d225cd (patch) | |
tree | 367b92ff985af8844043d8de5ce8c884a0b4ecea /pkg/errorhandling/errorhandling.go | |
parent | 397de44d487e25b5820777fcbab9728cf2af5e14 (diff) | |
parent | 204493173e26fcb07362804142e3e722a657216e (diff) | |
download | podman-8f0a53c974cdaebb4cb46e04e27d3c3204d225cd.tar.gz podman-8f0a53c974cdaebb4cb46e04e27d3c3204d225cd.tar.bz2 podman-8f0a53c974cdaebb4cb46e04e27d3c3204d225cd.zip |
Merge pull request #7561 from vrothberg/fix-7340
remote run: fix error checks
Diffstat (limited to 'pkg/errorhandling/errorhandling.go')
-rw-r--r-- | pkg/errorhandling/errorhandling.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/errorhandling/errorhandling.go b/pkg/errorhandling/errorhandling.go index 3117b0ca4..ca6b60bc5 100644 --- a/pkg/errorhandling/errorhandling.go +++ b/pkg/errorhandling/errorhandling.go @@ -57,3 +57,11 @@ func CloseQuiet(f *os.File) { logrus.Errorf("unable to close file %s: %q", f.Name(), err) } } + +// Contains checks if err's message contains sub's message. Contains should be +// used iff either err or sub has lost type information (e.g., due to +// marshaling). For typed errors, please use `errors.Contains(...)` or `Is()` +// in recent version of Go. +func Contains(err error, sub error) bool { + return strings.Contains(err.Error(), sub.Error()) +} |