AdWords API Re: APIException

2008-12-03 Thread Pete Lavetsky (AdWords API Guru)

This is Java but should be very close:

try {
  //Something
} catch( ApiException apiException ) {
log.error( There was a problem:  + apiException.getMessage1() );
log.error( The error code is  + apiException.getCode() );
if( apiException.getTrigger() != null )
log.error( The trigger was  + apiException.getTrigger() );

if( apiException.getErrors() != null  apiException.getErrors
().length  0 ) {
log.info( The error was : );
ApiError error = apiException.getErrors()[0];
log.error(  code:  + error.getCode() );
log.error(  detail:  + error.getDetail() );
log.error(  field:  + error.getField() );
log.error(  index:  + error.getIndex() );
log.error(  trigger:  + error.getTrigger() );
log.error(  textindex:  + error.getTextIndex() );
log.error(  textlength:  + error.getTextLength() );
log.error(  isexemptable:  + error.isIsExemptable() );
}
}

Pete
On Dec 3, 3:09 pm, AdWords API Advisor [EMAIL PROTECTED]
wrote:
 Hello Anton,

  I'm not sure I understand your question. What are you trying to
 accomplish?

 Cheers,
 -Jeff Posnick, AdWords API Team

 On Dec 3, 8:15 am, AKa [EMAIL PROTECTED] wrote:

  Hello,
  can me anybody show a example how can I use APIException object from
  AdWords API  in .NET?

  Regards
  Anton Kalcik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
AdWords API Forum group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en
-~--~~~~--~~--~--~---



AdWords API Re: APIException

2008-12-03 Thread Peer Jakobsen (AdWords API Guru)

Hi Anton,

In .NET you have to treat the error object as an xml document.
Basically you treat the exceptions Detail property as an XmlNode and
then extract the data as you would from any Xml document. You could
create the classes for the exception and error objects and then have
the deserializer cast the Detail node into those objects (I guess
thats what JAVA does automatically). I find it faster to just extract
the information needed directly from the XML.

Cheers,
Peer Jakobsen

The Detail

On Dec 3, 5:15 am, AKa [EMAIL PROTECTED] wrote:
 Hello,
 can me anybody show a example how can I use APIException object from
 AdWords API  in .NET?

 Regards
 Anton Kalcik
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
AdWords API Forum group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en
-~--~~~~--~~--~--~---