{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/passport/issues/645","repository_url":"https://api.github.com/repos/laravel/passport","labels_url":"https://api.github.com/repos/laravel/passport/issues/645/labels{/name}","comments_url":"https://api.github.com/repos/laravel/passport/issues/645/comments","events_url":"https://api.github.com/repos/laravel/passport/issues/645/events","html_url":"https://github.com/laravel/passport/pull/645","id":298964831,"number":645,"title":"Call custom exceptions handling if exists for JSON APIs","user":{"login":"igorjacauna","id":459127,"avatar_url":"https://avatars2.githubusercontent.com/u/459127?v=4","gravatar_id":"","url":"https://api.github.com/users/igorjacauna","html_url":"https://github.com/igorjacauna","followers_url":"https://api.github.com/users/igorjacauna/followers","following_url":"https://api.github.com/users/igorjacauna/following{/other_user}","gists_url":"https://api.github.com/users/igorjacauna/gists{/gist_id}","starred_url":"https://api.github.com/users/igorjacauna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorjacauna/subscriptions","organizations_url":"https://api.github.com/users/igorjacauna/orgs","repos_url":"https://api.github.com/users/igorjacauna/repos","events_url":"https://api.github.com/users/igorjacauna/events{/privacy}","received_events_url":"https://api.github.com/users/igorjacauna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-21T13:13:22Z","updated_at":"2018-02-21T14:28:23Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/laravel/passport/pulls/645","html_url":"https://github.com/laravel/passport/pull/645","diff_url":"https://github.com/laravel/passport/pull/645.diff","patch_url":"https://github.com/laravel/passport/pull/645.patch"},"body":"Inserting a custom method call int `HandlesOAuthErrors.php@withErrorHandling` that allow to handle exceptions that not fire the custom laravel exception handler in `\\App\\Exceptions\\Handler`\r\n\r\n`return $this->exceptionHandler()->renderForApi($response);`\r\n\r\nWill try call `renderForApi` method in `\\App\\Exceptions\\Handler` if it exists. If not exists will return the `$reponse` handled by Passport \r\n\r\nCalling custom function allow to use localization in Exceptions messages and make some traits if wish before throw the exception.\r\n\r\nWithout this we cannot change messages or localize the messages if we use the Passport in a JSON API"},"comment":{"url":"https://api.github.com/repos/laravel/passport/issues/comments/367343254","html_url":"https://github.com/laravel/passport/pull/645#issuecomment-367343254","issue_url":"https://api.github.com/repos/laravel/passport/issues/645","id":367343254,"user":{"login":"igorjacauna","id":459127,"avatar_url":"https://avatars2.githubusercontent.com/u/459127?v=4","gravatar_id":"","url":"https://api.github.com/users/igorjacauna","html_url":"https://github.com/igorjacauna","followers_url":"https://api.github.com/users/igorjacauna/followers","following_url":"https://api.github.com/users/igorjacauna/following{/other_user}","gists_url":"https://api.github.com/users/igorjacauna/gists{/gist_id}","starred_url":"https://api.github.com/users/igorjacauna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorjacauna/subscriptions","organizations_url":"https://api.github.com/users/igorjacauna/orgs","repos_url":"https://api.github.com/users/igorjacauna/repos","events_url":"https://api.github.com/users/igorjacauna/events{/privacy}","received_events_url":"https://api.github.com/users/igorjacauna/received_events","type":"User","site_admin":false},"created_at":"2018-02-21T14:28:23Z","updated_at":"2018-02-21T14:28:23Z","author_association":"NONE","body":"Ok. I changed to `method_exists` and uncommented the test lines.\r\n\r\nI commented out the lines in test becase the  `get` from `$config` was not called anymore. If I did some mistake I need a little help here to understand this scenario. \r\n\r\nNow the `phpunit` results show ony one fail:\r\n\r\n```\r\nAccessTokenControllerTest::test_exceptions_are_handled\r\nMockery\\Exception\\InvalidCountException: Method get(<Any Arguments>) from Mockery_0 should be called\r\n exactly 1 times but called 0 times.\r\n```"}}
{"actor":{"display_login":"igorjacauna"}}