Answers.Body: <p>You can use try/catch and the CiviCRM_API3_Exception class to get more information. It would be something like this:</p>
  
  <pre><code>try{
    $result = civicrm_api3('contact', 'get', $params);
  }
  catch (CiviCRM_API3_Exception $e) {
    // handle error here
    $errorMessage = $e-&gt;getMessage();
    $errorCode = $e-&gt;getErrorCode();
    $errorData = $e-&gt;getExtraParams();
    return array('error' =&gt; $errorMessage, 'error_code' =&gt; $errorCode, 'error_data' =&gt; $errorData);
  }
  </code></pre>
  
  <p>The getExtraParams method should give you what you are looking for.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-10T00:31:17.323Z
Answers.Text: That doesn't seem to be addressing question of a chained call, and getting the debug info from between the calls.
Answers.UserDisplayName: Joe Murray
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-09T16:01:53.687Z
Answers.LastActivityDate: 2015-05-02T17:48:27.693Z
Answers.LastEditDate: 2015-05-02T17:48:27.693Z
Answers.UserDisplayName: Tyrell Cook
Body: <p>How can I get back a dump of the full param array when a chained api call fails, so that I can see what values are coming back from the previous call and going into the chained call (and thus better troubleshoot cause of failure)?</p>
  
  <p>I know that I can add the "debug" param into the array, but I can't seem to read the trace in a way that tells me what $value was returned from the previous call and inserted to the chained call.</p>
  
Tags: <api><chaining>
Title: How to debug chained API calls
ThreadText: # How to debug chained API calls
  
  (Asked by: username_0 on 2015-04-09)
  
  How can I get back a dump of the full param array when a chained api call fails, so that I can see what values are coming back from the previous call and going into the chained call (and thus better troubleshoot cause of failure)?
  
  I know that I can add the "debug" param into the array, but I can't seem to read the trace in a way that tells me what $value was returned from the previous call and inserted to the chained call.
  
  **Tags:** api, chaining
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-09. Score: 1
  
  You can use try/catch and the CiviCRM_API3_Exception class to get more information. It would be something like this:
  try{
    $result = civicrm_api3('contact', 'get', $params);
  }
  catch (CiviCRM_API3_Exception $e) {
    // handle error here
    $errorMessage = $e->getMessage();
    $errorCode = $e->getErrorCode();
    $errorData = $e->getExtraParams();
    return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
  }
  
  The getExtraParams method should give you what you are looking for.
  
  > **Comments:**
  > **username_2**: That doesn't seem to be addressing question of a chained call, and getting the debug info from between the calls.  
  
  ---
  
  