mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-25 23:45:52 +03:00
[GH-ISSUE #137] Clean up and re-structure the errors #50
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#50
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @marioortizmanero on GitHub (Oct 11, 2020).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/137
The
ClientErrortype currently defined for the next release could definitely be improved. Some of its variants are repetitive and confusing. I kept adding variants for the rewrite without thinking much about the structure because the important thing was to get the rewrite done. But I would like to discuss what it should be like.Here's more or less the current definition:
Some thoughts:
StatusCode,Request,RateLimitedandUnauthorizedcould be wrapped under the same variant. These are just possible HTTP errors, so something likeHTTPErrorcould do fine. I understand that havingUnauthorizedand such can be useful to match against these specific errors, but ifHTTPErrorwas defined properly it wouldn't be necessary (say, usinghttp::status::StatusCode, for example).CLIshould be renamed toUserError? It describes better its purpose.CacheFilenecessary? I don't see it used anywhere, and it could be replaced withIO.ParseURLandParseJSONbe wrapped under aParsevariant? Maybe that's unnecessary?InvalidAuthbe renamed to something different? It might be confusing when compared toUnauthorized, butInvalidAuthmeans that Spotify wasn't initialized correctly (say, there's no token when it's needed). MaybeMissingAuth? IDK///). They should include a comment with a brief description.Please let me know any other problems you see and if you'd like to change something else.
@hrkfdn commented on GitHub (Oct 18, 2020):
Hey,
Some very reasonable points.
Something I'd like to point out: The
RateLimitedenum variant also contains the duration to wait until the new request can be made (taken fromRetry-Afterheader, see https://developer.spotify.com/documentation/web-api/#rate-limiting). It would be nice if that's still accessible with the refactorings.