{"action":"created","issue":{"url":"https://api.github.com/repos/recurly/recurly-client-php/issues/207","repository_url":"https://api.github.com/repos/recurly/recurly-client-php","labels_url":"https://api.github.com/repos/recurly/recurly-client-php/issues/207/labels{/name}","comments_url":"https://api.github.com/repos/recurly/recurly-client-php/issues/207/comments","events_url":"https://api.github.com/repos/recurly/recurly-client-php/issues/207/events","html_url":"https://github.com/recurly/recurly-client-php/issues/207","id":136401391,"number":207,"title":"Reworked pager is a breaking change in the API","user":{"login":"TimHas","id":178673,"avatar_url":"https://avatars.githubusercontent.com/u/178673?v=3","gravatar_id":"","url":"https://api.github.com/users/TimHas","html_url":"https://github.com/TimHas","followers_url":"https://api.github.com/users/TimHas/followers","following_url":"https://api.github.com/users/TimHas/following{/other_user}","gists_url":"https://api.github.com/users/TimHas/gists{/gist_id}","starred_url":"https://api.github.com/users/TimHas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimHas/subscriptions","organizations_url":"https://api.github.com/users/TimHas/orgs","repos_url":"https://api.github.com/users/TimHas/repos","events_url":"https://api.github.com/users/TimHas/events{/privacy}","received_events_url":"https://api.github.com/users/TimHas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-25T14:25:58Z","updated_at":"2016-03-07T14:09:19Z","closed_at":null,"body":"With the following change most of the error handling has to be reworked and rethought. Not cool.\r\nhttps://github.com/recurly/recurly-client-php/pull/195\r\n"},"comment":{"url":"https://api.github.com/repos/recurly/recurly-client-php/issues/comments/193260062","html_url":"https://github.com/recurly/recurly-client-php/issues/207#issuecomment-193260062","issue_url":"https://api.github.com/repos/recurly/recurly-client-php/issues/207","id":193260062,"user":{"login":"nerrad","id":1429108,"avatar_url":"https://avatars.githubusercontent.com/u/1429108?v=3","gravatar_id":"","url":"https://api.github.com/users/nerrad","html_url":"https://github.com/nerrad","followers_url":"https://api.github.com/users/nerrad/followers","following_url":"https://api.github.com/users/nerrad/following{/other_user}","gists_url":"https://api.github.com/users/nerrad/gists{/gist_id}","starred_url":"https://api.github.com/users/nerrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nerrad/subscriptions","organizations_url":"https://api.github.com/users/nerrad/orgs","repos_url":"https://api.github.com/users/nerrad/repos","events_url":"https://api.github.com/users/nerrad/events{/privacy}","received_events_url":"https://api.github.com/users/nerrad/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T14:09:19Z","updated_at":"2016-03-07T14:09:19Z","body":"There is an issue with the pager (but I'm seeing this not with the billing info class):\r\n\r\nHere's an example code snippet I have:\r\n\r\n```\r\ntry {\r\n\t\t\t\t$subscriptions = Recurly_SubscriptionList::getForAccount(\r\n\t\t\t\t\t$account_id,\r\n\t\t\t\t\t$args\r\n\t\t\t\t);\r\n\t\t\t\tif ( $subscriptions instanceof Recurly_SubscriptionList ) {\r\n\t\t\t\t\t$this->_subscription_user_cache[$user_id][$state] = $subscriptions;\r\n\t\t\t\t}\r\n\t\t\t} catch ( Recurly_NotFoundError $e ) {\r\n\t\t\t\t//let's verify if the account_code is correct, and if not then we reset the account\r\n\t\t\t\ttry {\r\n\t\t\t\t\t$account = Recurly_Account::get( $account_id );\r\n\t\t\t\t} catch ( Recurly_NotFoundError $e ) {\r\n\t\t\t\t\t//account_code is incorrect so let's remove the cached link\r\n\t\t\t\t\tself::remove_remote_account_id_for_user( $user_id );\r\n\t\t\t\t}\r\n\t\t\t\t$subscriptions = array();\r\n\t\t\t}\r\n```\r\n\r\nearlier code grabs the account_id that is linked to the local user.  Previously, if there was an issue with the account_id, the `Recurly_NotFoundError` exception would be triggered, and I'd verify that it was the account_id.\r\n\r\nHowever the client code calling this snippet is getting a valid `Recurly_SubscriptionList` object returned and then when it does this:\r\n\r\n```\r\nif ( $subscriptions instanceof Recurly_SubscriptionList ) {\r\n\t\t\t\t\t\t$subscriptions->rewind();\r\n```\r\n\r\nthat produces:\r\n\r\n```\r\n\"PHP message: PHP Fatal error:  Uncaught exception 'Recurly_NotFoundError' with message 'Couldn't find Account with account_code = 56cf3e2868ebf' in /home/eeliveadmin/www/eelive/wp-content/plugins/pue-product-management/libraries/recurly/recurly/response.php:55\r\nStack trace:\r\n#0 /home/eeliveadmin/www/eelive/wp-content/plugins/pue-product-management/libraries/recurly/recurly/pager.php(93): Recurly_ClientResponse->assertValidResponse()\r\n#1 /home/eeliveadmin/www/eelive/wp-content/plugins/pue-product-management/libraries/recurly/recurly/pager.php(37): Recurly_Pager->_loadFrom('/accounts/56cf3...')\r\n#2 /home/eeliveadmin/www/eelive/wp-content/plugins/pue-product-management/main/business/recurly/PUE_PM_Recurly_Adapter.php(449): Recurly_Pager->rewind()\r\n```\r\n\r\nThe only thing I can think of, is this account_code is attached to a transaction that was declined, and does not exist as a full account in recurly (a _transition_ account?).  For some reason this valid account_code check is being delayed until the pager is run.\r\n\r\nAs the original poster pointed out, this requires a different method of error checking by client code.  Is it _expected_ that this exception would be triggered by the pager?\r\n\r\n\r\n\r\n"}}