≈ the.bay.news

Is preventing the propagation of `try` usually a good idea?

Ziggit
Is preventing the propagation of `try` usually a good idea?
Over time, I’ve found that there’s a lot of APIs in Zig that constantly return errors I can’t really do anything about if they happen. error.OutOfMemory is an example, and error.WriteFailed is another. When writing a library I can’t know the context of the calling code (who may actually be able to handle the error), so in those cases I do just propagate the error to the caller by using try everywhere. In an application context though, where I know if the thing returns OOM or the Writer fails t...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.