Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Attach errors to NotFound exception to be able to always have the full error response available #760

Closed
wants to merge 1 commit into from

Conversation

pelletiermaxime
Copy link

Hello, I was a bit confused when looking at the NotFound Exception because the errors() method always returned an empty array. After a bit of research I found that you catched that specific exception in Messaging.php and created a new NotFound, but lost the errors array that was previously created by convertResponse(). A simple fix is to add back the errors to becauseTokenNotFound().
I only tested this in 5.x because of limitations (php 7.4 and Guzzle 6), but the problem seems to also be in 7.x.

@jeromegamez
Copy link
Member

This was a good catch, thank you very much! I merged this with 482d803 - I didn't change your code, just added the tests to ensure the fixed behavior, and updated the README.

Since you were so kind to contribute, and you shared that you are stuck with 5.x (and because I checked if it was easy to do 😅), I backported your fix to the older versions and published new releases for all of them:

And just like that, you made three commits instead of just one 😅

Thanks again!

@pelletiermaxime
Copy link
Author

Wow I didn't expect that! Thank you so much, amazing work on the library!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants