3 ms·
If Panic doesn't cross goroutine boundaries, why should exceptions?
by flogic 14y ago
If Panic doesn't cross goroutine boundaries, why should exceptions?
- drivebyacct2 14y agoThe whole point is, it wouldn't make sense for them to cross goroutine boundaries, but the pleasure of Go is the ease with which you can use goroutines. Thus, in a lot of places where people would lazily use exceptions to aggregate potential errors, you would be unable to because the exception is occuring in a goroutine. Which is why there are other nice ways of communicating such states in go that go hand in hand with handling errors at their occurrence. If you find an error in a goroutine, you can signal that on a channel, return and wait for a new goroutine to be restarted in place of the errored one.