func runSafely(f func() error) (err error) {
	defer func() {
		if panicResult := recover(); panicResult != nil {
			err = errors.Errorf("panic resulted in: %v", panicResult)
			err = &errWithStackTrace{err, string(debug.Stack())}
		}
	}()
	return f()
}
// runSafely will ensure that the function is run, and any error is returned.
// If there is a panic, then that will be returned as an error.
runSafely will ensure that the function is run, and any error is returned.
If there is a panic, then that will be returned as an error.
// runSafely will ensure that the function is run and any error is returned . // If there is a panic then that will be returned as an error .
func runSafely(f func() error) (err error) {
	defer func() {
		if panicResult := recover(); panicResult != nil {
			err = errors.Errorf("panic resulted in: %v", panicResult)
			err = &errWithStackTrace{err, string(debug.Stack())}
		}
	}()
	return f()
}
func runSafely ( f func ( ) error ) ( err error ) { defer func ( ) { if panicResult := recover ( ) ; panicResult != nil { err = errors . Errorf ( " " , panicResult ) err = & errWithStackTrace { err , string ( debug . Stack ( ) ) } } } ( ) return f ( ) }
runSafely will ensure that the function is run, and any error is returned.
runSafely will ensure that the function is run and any error is returned .