Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearer Error handling #8

Open
ollitapa opened this issue Apr 2, 2018 · 3 comments
Open

Clearer Error handling #8

ollitapa opened this issue Apr 2, 2018 · 3 comments

Comments

@ollitapa
Copy link

ollitapa commented Apr 2, 2018

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)
}
@dreymonde
Copy link
Owner

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.

@ollitapa
Copy link
Author

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.

@dreymonde
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants