question

dl-mozart46 avatar image
dl-mozart46 asked kirill-konshin49 answered

SDK error message response unexpected

This is more of a feedback than a problem report.

I've been working on a Web app that sends SMS using your PHP SDK.  However, I noticed that the way an error comes back to me is a bit unexpected.

When I forget to include SMS text, I would expect either 1) the SMS to be sent with empty body or 2) the error be included in the '$response' response per your suggested code here:  https://github.com/ringcentral/ringcentral-php

But instead, I get a "Fata Error" response that overwrites my calling PHP, like this:

" Fatal error: Uncaught exception 'Exception' with message 'Response has unsuccessful status' in /home/mozartdl57/ acmemedical.org/lib/RC/http/Request.php:171 Stack trace: #0 /home/mozartdl67/ acmemedical.org/lib/RC/platform/Platform.php(221): RC\http\Request->send() #1 /home/mozartdl67/ acmemedical.org/lib/RC/platform/Platform.php(264): RC\platform\Platform->apiCall(Object(RC\http\Request)) #2 /home/mozartdl67/ acmemedical.org/oncall_response.php(70): RC\platform\Platform->post('/account/~/exte...', NULL, Array) #3 {main} Next exception 'RC\http\HttpException' with message 'Parameter [text] value is invalid' in /home/mozartdl67/ acmemedical.org/lib/RC/http/Request.php:178 Stack trace: #0 /home/mozartdl67/ acmemedical.org/lib/RC/platform/Platform.php(221): RC\http\Request->send() #1 /home/mozartdl67/ acmemedical.org/lib/RC/platform/Platform.php(264): RC\platform\Platform->apiCall(Object(RC\http\Request)) #2 /home/mozartdl67/ acmemedical.org/oncall_response.php(70): RC\platform\Platform->post('/account/~/exte...', NULL, Array) #3 {main} thrown in /home/mozartdl67/ acmemedical.org/lib/RC/http/Request.php on line  178"

This is really hard to decipher and it took me a while to notice the "Parameter [text] value is invalid" buried in the above.

Just a feedback; otherwise your APIs and SDKs worked great.
topic-default
1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

·
kirill-konshin49 avatar image
kirill-konshin49 answered
In upcoming version 0.6.0 error message in HttpException contains parsed message from API.

In previous versions API error may be viewed by accessing getResponse() function of HttpException.
1 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.