blob: 4ded92a1cb66ad0bf35ffb4ec485614a69e07ece (
plain)
1
2
3
4
5
6
7
8
9
10
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()
}
|