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

Method Try

panics/panics.go:21–24  ·  view source on GitHub ↗

Try executes f, catching any panic it might spawn. It is safe to call from multiple goroutines simultaneously.

(f func())

Source from the content-addressed store, hash-verified

19// Try executes f, catching any panic it might spawn. It is safe
20// to call from multiple goroutines simultaneously.
21func (p *Catcher) Try(f func()) {
22 defer p.tryRecover()
23 f()
24}
25
26func (p *Catcher) tryRecover() {
27 if val := recover(); val != nil {

Callers 8

TryFunction · 0.95
ExampleCatcherFunction · 0.95
ExampleCatcher_callersFunction · 0.95
ExampleCatcher_errorFunction · 0.95
TestCatcherFunction · 0.95
TestRecoveredAsErrorFunction · 0.95
callbackerMethod · 0.95
GoMethod · 0.80

Calls 1

tryRecoverMethod · 0.95

Tested by 5

ExampleCatcherFunction · 0.76
ExampleCatcher_callersFunction · 0.76
ExampleCatcher_errorFunction · 0.76
TestCatcherFunction · 0.76
TestRecoveredAsErrorFunction · 0.76