zendframework / ZendService_Twitter

PHP OOP wrapper for the Twitter API
BSD 3-Clause "New" or "Revised" License
22 stars 23 forks source link

Response `getErrors()` method looking at the wrong property? #35

Open svpernova09 opened 8 years ago

svpernova09 commented 8 years ago

I believe I ran into a bug with regards to error handling in ZendService\Twitter\Response. I've fixed it here: https://github.com/calevans/ZendService_Twitter/pull/1

The only response docs around errors seems to be https://dev.twitter.com/ads/basics/response-codes which notes an errors property. Not sure if this related code should be checking for errors AND error or not.

Can anyone verify my question around error VS errors for Twitter error responses?

If this is indeed a bug I'm happy to open a PR here as well.

Thanks for your time.

adamlundrigan commented 8 years ago

I also could not find a definitive answer on this. The Twitter docs had this to say: (Source: https://dev.twitter.com/overview/api/response-codes#Node--108, then scroll down a bit)

When the Twitter API returns error messages, it does so in JSON format. For example, an error might look like this:

{"errors":[{"message":"Sorry, that page does not exist","code":34}]}

The might there gives me doubt that it's definitive. I used twit over on the node side of things once upon a time and looking into it's code they check for both. This Python code shared on StackOverflow checks for both as well, but assumes the error key will only ever be the result of a 401 and everything else will return errors.

weierophinney commented 5 years ago

@svpernova09 I was going to cherry-pick your patch to release in a bugfix, but the page you linked (https://developer.twitter.com/en/docs/ads/general/guides/response-codes) clearly details an errors object is returned at this time. I'm assuming this is something changed in the Twitter API since you submitted originally, but can you verify?

weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-twitter; a new issue has been opened at https://github.com/laminas/laminas-twitter/issues/1.