RTC Forums
April 27, 2024, 12:08:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Exception  (Read 3152 times)
piotrsw
Newbie
*
Posts: 1


« on: January 27, 2012, 01:43:39 PM »

In case of exception my xml-rpc server returns:

<value><struct>
<member><name>faultCode</name><value><int>116</int></value></member>
<member><name>faultString</name><value><string>Error description</string></value></member>
</struct></value>

In OnReturn event i can get Result.asException but it returns string value. How to get faultCode and faultString from Result?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: January 27, 2012, 02:19:44 PM »

If you get a FaultCode as part of the XML-RPC result, the "asException" string will contain the FaultCode as well as the FaultString in the following format:

'#'+faultcode+':'+faultstring

In other words, if you have received FaultCode '116' and FaultString 'Error descriotion', then "asException" will return:

'#116:Error description'

The same way, if you are writing a Server and you want to return error message with FaultCode '116' and FaultString 'ErrorDescription', you would need to set the asException value to '#116:ErrorDescription'.

Note: A FaultCode of 0 (zero) is handled as "no fault code" and will result in "asException" containing only the FaultString, without the preceding "#0:'. In other words, if "asException" is returning a string which doesn't start with '#', then the Server has either sent a FaultCode 0, or hasn't explicitly set a FaultCode (left empty or null).

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.022 seconds with 16 queries.