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

Error handling #8

Open
mnutt opened this issue Dec 6, 2020 · 1 comment
Open

Error handling #8

mnutt opened this issue Dec 6, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@mnutt
Copy link

mnutt commented Dec 6, 2020

I see that it looks like API errors are getting logged out properly via a handle() method, but would it make sense to expose these in the method completion as well? Right now, for instance, if a MediaItem upload fails I just receive res as [], or if adding photos to an album fails I just receive false. In my case this is because I'm uploading a lot of photos and getting 429 Quota exceeded API responses, and I'd like to back off and try again. Whereas with other errors, I'd probably want to just give up and show an error message.

I assume it's a bit more complicated by the fact that the failure could be an HTTP status error or it could be something lower down the stack, so I assume we'd either need two extra arguments to the completion (maybe Status? and Error?) or a single Error? that could be switched to either a Status or other type of Error. But I'm not as familiar with Swift error handling best practices so feel free to disregard these suggestions.

@deivitaka
Copy link
Owner

@mnutt thanks for the suggestions. I will try to implement better error handling in the following version. I think returning a Result would be a good way to separate google errors from network errors.

@deivitaka deivitaka added the enhancement New feature or request label Dec 7, 2020
@deivitaka deivitaka self-assigned this Dec 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants