SDK error message response unexpected

  • 1
  • Problem
  • Updated 3 years ago
  • Acknowledged
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.
Photo of DL Mozart

DL Mozart

  • 120 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Kirill Konshin

Kirill Konshin, Official Rep

  • 60 Points
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.