Back to Lo

Core Trywitherrorvalue

docs/data/core-trywitherrorvalue.md

1.53.0208 B
Original Source

Runs a function and returns the error value (panic or error) along with a boolean indicating success.

go
err, ok := lo.TryWithErrorValue(func() error { panic("error") })
// err == "error", ok == false