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 would appreciate some examples how basic error handling is supposed to work with Peony in the docs & and code examples in examples/. I noticed somewhat more advanced error handling in the section Handle errors for every request, though, but I think that should remain a separate section.
For example: API error on user lookup (suspended account or user does not exist).
For context see my trial-and-error in #37. I'm more than happy to contribute some examples once I understand this a bit better. 😄
The text was updated successfully, but these errors were encountered:
For error handling try: ... except: would most likely be fine for most use cases. PeonyException is the parent class of all the errors that Peony will raise. One thing to keep in mind (at least when using the master branch or a future release) the errors that are related to HTTP error codes should be the latest to be caught so that you don't override the behaviour you defined for a more specific Twitter error. For now it's mostly described in #32 from back when I made this change but that should eventually end up in the documentation too. It would be great to have more examples featuring more complete error handling.
I don't think many users will find a use for error handlers, although that would be interesting to see and maybe even worth being featured in the documentation or as part the library if it makes sense for some use cases. It could also have some very specific uses, maybe in a graphical application you could use that to show a generic notification when an error is encountered.
The default error handler takes care of rate limits and server unavailability and retries the requests according to recommendations from Twitter (It should still be somewhere in the API documentation).
At some point I wanted to turn Peony into a library that could be used with any REST API, so that would have been helpful for that too.
I would appreciate some examples how basic error handling is supposed to work with Peony in the docs & and code examples in
examples/
. I noticed somewhat more advanced error handling in the section Handle errors for every request, though, but I think that should remain a separate section.For example: API error on user lookup (suspended account or user does not exist).
For context see my trial-and-error in #37. I'm more than happy to contribute some examples once I understand this a bit better. 😄
The text was updated successfully, but these errors were encountered: