worldia / textmaster-api

Simple PHP client for the Textmaster API
1 stars 5 forks source link

ResponseMediator does not always throw exceptions #72

Closed jmleroux closed 8 years ago

jmleroux commented 8 years ago

For some Textmaster responses, the ResponseMediator does not throw exception because the error message is not in the first level of the retruned array. Example : This method will return an array where the error is not at first level, so the ResponseMediator will not see it.

Here is the code to thorw an exception : https://github.com/worldia/textmaster-api/blob/master/lib/Textmaster/HttpClient/Message/ResponseMediator.php#L33

Shouldn't it be better to also parse the response HTTP_CODE to detect errors ?

Regards, JM

cdaguerre commented 8 years ago

You're right, http status code should be checked as well. Could you make a PR?

jmleroux commented 8 years ago

I don't have much time right now. If i find some time, i will.