Clearer Error handling
Opened this issue · 3 comments
Would it be possible to define a common Error enum for the StorageProtocol? Seems that now the errors are simply Error protocol, so making switch cases to determine the real cause is difficult.
For example
enum StorageError {
case general(error: Error)
case write(error: Error)
case noValue(for: Key)
}
Hi! I’m sorry that I leaved this unaddressed for so long. This actually sounds like a reasonable idea, I’ll think about it definitely.
No problem, thanks!
Also if you want to consider the Result object from here https://github.com/antitypical/Result
I've seen it widely used and Shallows.Result conflicts with that type and namespace.
I decided not to include antitypical/Result in Shallows because nested dependencies adds a lot of complexity, and usually are just not worth it. Most of the time, you won’t need to refer to Result
directly, and when you need to, you can always unambiguate with Shallows.Result
. It’s a tradeoff but I think it’s good enough.