You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think using exceptions instead of returning tuples will buy us anything for the general API methods. In most cases it's a direct call to e.g. get a note and not getting it is not really an exception but can happen rather regularly (I'm usually encountering a lot of failed API calls from the Simplenote API). So it would change the existing API a fair bit, but not really give us a big advantage.
The authentication bug (issue #4) on the other hand could really benefit from raising an exception in the authenticate method whenever we get a failed login from the API. I think something like SimplenoteLoginFailed should do the job here.
Exceptions would make the API more usable, instead having to deal with a tuple as a retval, you can just enclose your code in try: except:, also you wouldn't have to check every time for a negative status code.
Also the fact that get_note (only an example) can return some exception I think is not semantically correct.
Wouldn't it be more elegant to raise exceptions when something goes wrong, instead of returning touples?
Just saying... it would be more OOPish.
I can help, just let me know if it would be OK, so I don't invest time for nothing.
I could also look into #4.
The text was updated successfully, but these errors were encountered: