norkunas / onesignal-php-api

OneSignal API for PHP
MIT License
233 stars 82 forks source link

Recover the error #130

Closed staffxxx closed 4 years ago

staffxxx commented 4 years ago

I wanted to recover the error so I did this try { //code here } catch(Exception $e) { echo $e->getMessage(); }

This does not show a result : Client error:DELETE https://onesignal.com/api/v1/players/50?app_id=a20576b6-5348-4df7-a56a-26resulted in a400 Bad Requestresponse: {"errors":["No user with this id found"]}

How to recover the response in array?

Thank you

norkunas commented 4 years ago

Hello,

Currently there is no way, but it will be in v2 release, until that you can parse the message and use json decode.

staffxxx commented 4 years ago

Thank you norkunas for your answer. Do not have a solution while waiting for version 2?

When do you think version 2 will be released

norkunas commented 4 years ago

Maybe before christmas :) We could update for now code to set the original exception as previous, so you could access it with request/response data. Wanna submit a PR?

staffxxx commented 4 years ago

I do not understand Wanna submit to PR?

norkunas commented 4 years ago

Do you want to contribute submitting a pull request with code changes?

staffxxx commented 4 years ago

Yes I want ;)

norkunas commented 4 years ago

I guess you aren't familiar with git? :) If that's the case you can read more about it here https://github.com/firstcontributions/first-contributions

norkunas commented 4 years ago

v2 is released.