Question

SDK error message response unexpected

  • 28 July 2015
  • 1 reply
  • 748 views

  • Anonymous
  • 0 replies

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): RChttpRequest->send() #1 /home/mozartdl67/acmemedical.org/lib/RC/platform/Platform.php(264): RCplatformPlatform->apiCall(Object(RChttpRequest)) #2 /home/mozartdl67/acmemedical.org/oncall_response.php(70): RCplatformPlatform->post('/account/~/exte...', NULL, Array) #3 {main} Next exception 'RChttpHttpException' 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): RChttpRequest->send() #1 /home/mozartdl67/acmemedical.org/lib/RC/platform/Platform.php(264): RCplatformPlatform->apiCall(Object(RChttpRequest)) #2 /home/mozartdl67/acmemedical.org/oncall_response.php(70): RCplatformPlatform->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.


1 reply

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.

Reply