mirror of
https://codeberg.org/superseriousbusiness/gotosocial.git
synced 2024-12-25 18:38:17 +03:00
906639ad7e
* update viper version * removes our last uses of the slice package * fix tests
11 lines
291 B
Go
11 lines
291 B
Go
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()
|
|
}
|