• timc@xegy
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

language: C#

sforce API version 2.5

 

I am trying to code for rate-limiting by catching fault code 1010 (as per the API Developer's Guide).  The Developer's Guide indicates that if an exception occurs on an API call, an exception is thrown and an ApiFault is returned.  The ApiFault can be inspected to determine the fault code (ApiFault.exceptionCode).

I don't understand how to retrieve the ApiFault object, e.g. in a typical try/catch block:

try { ...some API } catch (Exception e) { ...handle the exception }

the exception is from C# and does not have the exceptionCode member.  Would I cast the exception as an ApiFault ?.  Or is the sObject returned by the API call to be cast as an ApiFault?  By way of experiment, I tried to declare something as an ApiFault (ApiFault x and the compiler complains that ApiFault is not in the namespace.  I checked the WSDL and ApiFault is defined.  Clearly I am not understanding how to get at the ApiFault. 

Would somebody be so kind as to clarify this for me?

Thanks,

TimC

     

language: C#

sforce API version 2.5

 

I am trying to code for rate-limiting by catching fault code 1010 (as per the API Developer's Guide).  The Developer's Guide indicates that if an exception occurs on an API call, an exception is thrown and an ApiFault is returned.  The ApiFault can be inspected to determine the fault code (ApiFault.exceptionCode).

I don't understand how to retrieve the ApiFault object. 

try {

 

language: C#

sforce API version 2.5

 

I am trying to code for rate-limiting by catching fault code 1010 (as per the API Developer's Guide).  The Developer's Guide indicates that if an exception occurs on an API call, an exception is thrown and an ApiFault is returned.  The ApiFault can be inspected to determine the fault code (ApiFault.exceptionCode).

I don't understand how to retrieve the ApiFault object, e.g. in a typical try/catch block:

try { ...some API } catch (Exception e) { ...handle the exception }

the exception is from C# and does not have the exceptionCode member.  Would I cast the exception as an ApiFault ?.  Or is the sObject returned by the API call to be cast as an ApiFault?  By way of experiment, I tried to declare something as an ApiFault (ApiFault x and the compiler complains that ApiFault is not in the namespace.  I checked the WSDL and ApiFault is defined.  Clearly I am not understanding how to get at the ApiFault. 

Would somebody be so kind as to clarify this for me?

Thanks,

TimC