diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-01-02 11:58:29 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-01-22 13:17:53 +0000 |
| commit | 7512e6e7738143bd302d9b20cb1fd0d1d7af9643 (patch) | |
| tree | 67988d580d111bacbd009acfc0057f89aafa6522 /vendor/github.com/sourcegraph/conc/panics/try.go | |
| parent | 44f2ad31190603135f4ac758273f26111ca6003c (diff) | |
vendor: fetch the dependencies
Diffstat (limited to 'vendor/github.com/sourcegraph/conc/panics/try.go')
| -rw-r--r-- | vendor/github.com/sourcegraph/conc/panics/try.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vendor/github.com/sourcegraph/conc/panics/try.go b/vendor/github.com/sourcegraph/conc/panics/try.go new file mode 100644 index 000000000..4ded92a1c --- /dev/null +++ b/vendor/github.com/sourcegraph/conc/panics/try.go @@ -0,0 +1,11 @@ +package panics + +// Try executes f, catching and returning any panic it might spawn. +// +// The recovered panic can be propagated with panic(), or handled as a normal error with +// (*panics.Recovered).AsError(). +func Try(f func()) *Recovered { + var c Catcher + c.Try(f) + return c.Recovered() +} |
