Clean up and re-structure the errors #137
Labels
discussion
Some discussion is required before a decision is made or something is implemented
help wanted
Extra attention is needed
Milestone
The
ClientError
type 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
,RateLimited
andUnauthorized
could be wrapped under the same variant. These are just possible HTTP errors, so something likeHTTPError
could do fine. I understand that havingUnauthorized
and such can be useful to match against these specific errors, but ifHTTPError
was defined properly it wouldn't be necessary (say, usinghttp::status::StatusCode
, for example).CLI
should be renamed toUserError
? It describes better its purpose.CacheFile
necessary? I don't see it used anywhere, and it could be replaced withIO
.ParseURL
andParseJSON
be wrapped under aParse
variant? Maybe that's unnecessary?InvalidAuth
be renamed to something different? It might be confusing when compared toUnauthorized
, butInvalidAuth
means 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.
The text was updated successfully, but these errors were encountered: