Hacker News new | ask | show | jobs
by gclaramunt 3648 days ago
For 1 and 4, is not for runtime exceptions (div by 0, out of memory, etc) that you need to bubble up to the top, is for "logic"/checked exceptions where you want to use code to deal with the failure case. For 3, that totally defeats the purpose, the whole point is to have a single error type (it can capture the details of the error anyway) then you can have

  Foo -> Result<Foo1,Error>
  Foo1 -> Result<Foo2,Error>
  Foo2 -> Result<Foo3,Error>
And use bind to compose them easily.

I think the confusing part is the word "exception" as it mixes concepts.