I want to define a tripartite `Result` type which represents success, expected failure and unexpected failure (not for the first time I've tried but I have union types now!). It would be nice if I could find three equal-length words which convey these concepts. Which do you like?
I think the distinction is useful because exceptions aren't a closed set, and third-party code which you might call is a black box: you can anticipate every exception you know, and still get something unexpected.
-
-
And I think that those unexpected Exceptions don't have to represent crashes; just unknown failures. Provided they're not recognised crash states (i.e. OOM, SO, etc) I think it's reasonable to catch them and treat them as unknown failures.
-
There may be different scopes at which those unknown failures are handled. Sure, third-party could could make unknown changes to global state, but I still think that it's often reasonable to assume that it didn't, and to treat these errors as recoverable.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.