You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
316 B
20 lines
316 B
package core
|
|
|
|
//run a method with panic recovery.
|
|
func RunWithRecovery(f func()) {
|
|
defer func() {
|
|
if err := recover(); err != nil {
|
|
LOGGER.Error("error in async method: %v", err)
|
|
}
|
|
}()
|
|
|
|
//execute the method
|
|
f()
|
|
}
|
|
|
|
//shortcut for panic check
|
|
func PanicError(err error) {
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|