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
If the account exists but there's no live subscription, when calling $subscriptions->current(), the code will throw new Recurly_Error("Pager is not in a valid state");.
try/catch would work but it would also catch the times where this error happens for other reasons and not only because of the empty results.
A simple solution found later was to explicitly verify if $subscription->count() > 0 before calling->current(). But, IMO, the error message being thrown is not related to the real issue, which can make the users confused.
Hey all,
I'm facing an issue where Recurly throws an exception if my query does not find a matching record.
For example:
If the account exists but there's no live subscription, when calling
$subscriptions->current()
, the code willthrow new Recurly_Error("Pager is not in a valid state");
.Here's the relevant code:
https://github.com/recurly/recurly-client-php/blob/master/lib/recurly/pager.php#L48-L60
This happens because
sizeof($this->_objects))
is 0 (because there's no live subscriptions), and there's no next link.This was changed in this commit, where this code was removed:
IMHO this still makes sense and should not be completely removed.
Any ideas on how to deal with this?
Thanks,
The text was updated successfully, but these errors were encountered: