Back to Lo

Core Trycatch

docs/data/core-trycatch.md

1.53.0176 B
Original Source

Calls the catch function when the callback errors or panics.

go
caught := false
lo.TryCatch(func() error { panic("error") }, func() { caught = true })
// caught == true