Class AdWordError

Description

AdWords Lib Error Class

  • copyright: Mirchev Ideas Ltd. © 2003, 2004, 2005

Located in /util/AdWordError.inc


	
			
Method Summary
 mixed get (string $errorPart)
 array getError ()
 string toString ()
Methods

Returns a specific part of the error

If you don't need all error fields, you can take just the part you want. All errors have 3 fields:

  • 'code' - the code of the error. All errors that were handled by PHP AdWords API Lib have negative codes. Errors with positive codes are errors returned by Google AdWords Service.
  • 'string' - a short text that explains error
  • 'detail' - an array which holds more information about the error

Example:

  1.  <?php
  2.  $creativeService new AdWordCreativeService(ADWORD_SOAP_TOOLKIT_NUSOAP);
  3.  $creativeService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  4.  //activateCreativeList() function expect arrays as input parameters
  5.  //but we pass to it two strings, so responce will be false
  6.  $response $creativeService->activateCreativeList('''');
  7.  if ($response === false{
  8.          $error $classKW->getLastError()//get error object
  9.          $errorCode $error->get('code');
  10.          echo $errorCode;
  11.          exit();
  12.  }
  13.  //output is :
  14.  //-2
  15.  ?>

mixed get (string $errorPart)
  • string $errorPart: the part of the error to be returned - 'code', 'string' or 'detail'

Returns an array that holds the error.

All errors have 3 fields:

  • 'code' - the code of the error. All errors that were handled by PHP AdWords API Lib have negative codes. Errors with positive codes are errors returned by Google AdWords Service.
  • 'string' - a short text that explains error
  • 'detail' - an array which holds more information about the error

Example:

  1.  <?php
  2.  $creativeService new AdWordCreativeService(ADWORD_SOAP_TOOLKIT_NUSOAP);
  3.  $creativeService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  4.  //activateCreativeList() function expect arrays as input parameters
  5.  //but we pass to it two strings, so responce will be false
  6.  $response $creativeService->activateCreativeList('''');
  7.  if ($response === false{
  8.          $error $classKW->getLastError()//get error object
  9.          $errorArray $error->getError();
  10.          echo $errorArray['code'];
  11.          echo '<br>';
  12.          echo $errorArray['string'];
  13.          exit();
  14.  }
  15.  //output is :
  16.  //-2
  17.  //Invalid input parameter. Array expected
  18.  ?>

array getError ()

Returns all parts of the error as a string

Example:

  1.  <?php
  2.  $creativeService new AdWordCreativeService(ADWORD_SOAP_TOOLKIT_NUSOAP);
  3.  $creativeService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  4.  //activateCreativeList() function expect arrays as input parameters
  5.  //but we pass to it two strings, so responce will be false
  6.  $response $creativeService->activateCreativeList('''');
  7.  if ($response === false{
  8.          $error $classKW->getLastError()//get error object
  9.          echo $error->toString();
  10.          exit();
  11.  }
  12.  ?>

string toString ()

Documentation generated on Mon, 10 Sep 2007 15:07:20 +0300 by phpDocumentor 1.3.2