Narrowing down error types #5
Replies: 2 comments 7 replies
My understanding is this is standard for Swift frameworks. As an example CryptoKit includes
Well whether they want to use a
I'm open to figuring out how to improve this, although I could see it significantly increasing the complexity of error generation. Because Apple's documentation is often seriously lacking ( |
|
See #14 which is in the spirit of this discussion. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
(continued from this comment)
Right now, this library (and SecureXPC) model their errors as enums whose cases are (roughly) 1-to-1 with the enums/constants of the underlying library. I see two usability difficulties with this:
bless(label:authorization)looks like it can throwjobMustBeEnabled(because that value exists in the look up table the error path uses), but it doesn't (or does it? I have no way to tell without digging into it, which is kind of the point).default: fatalError("this error case can't happen in this context"). Each user would have to rediscover that for themselves.I think we have an opportunity to do the research and pool it together, and codify it into use-case specific error enums. E.g.
BlessError, which only contains cases that can be thrown from the bless operation, and whose descriptions translates the general messages/comments of the error codes into concrete issues.What are your thoughts, Josh?
All reactions