MCPcopy Index your code
hub / github.com/sourcegraph/conc / Try

Function Try

panics/try.go:7–11  ·  view source on GitHub ↗

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().

(f func())

Source from the content-addressed store, hash-verified

5// The recovered panic can be propagated with panic(), or handled as a normal error with
6// (*panics.Recovered).AsError().
7func Try(f func()) *Recovered {
8 var c Catcher
9 c.Try(f)
10 return c.Recovered()
11}

Callers 1

TestTryFunction · 0.85

Calls 2

TryMethod · 0.95
RecoveredMethod · 0.95

Tested by 1

TestTryFunction · 0.68