jublo / codebird-php

Easy access to the Twitter REST API, Direct Messages API, Account Activity API, TON (Object Nest) API and Twitter Ads API — all from one PHP library.
https://www.jublo.net/projects/codebird/php
GNU General Public License v3.0
777 stars 235 forks source link

Error Handling #199

Closed Daltontastic closed 7 years ago

Daltontastic commented 7 years ago

How do I check if $reply = $cb->statuses_update($params); was a success or not?

Daltontastic commented 7 years ago

Can I check if it's TRUE or FALSE?

Daltontastic commented 7 years ago

I came up with a messy workaround :)

$data = (array) $reply; if (isset($data["created_at"])) { return true; } else { return false; }

mynetx commented 7 years ago

@Daltontastic If Twitter returns an error, you will have an error object in the reply. Maybe check for that? :)

https://dev.twitter.com/overview/api/response-codes

Daltontastic commented 7 years ago

Thanks for the amazing library btw :) I've been using it for over a year.

mynetx commented 7 years ago

@Daltontastic You’re welcome! 3.2.0 will be out soon, but we’re looking into the TON API authentication first.