title: Using additional data in php exceptions
body: <p>I have php code that execute python cgi and I want to pass python trace (returned from cgi) as extra data to php exception how can I do this and how can I get that value from <code>catch(Exception e) {</code> (It should check if that extra value exesit or not).</p>
  
  <p>I have code like this:</p>
  
  <pre><code>$response = json_decode(curl_exec($ch));
  if (isset($response-&gt;error)) {
      // how to send $response-&gt;trace with exception.
      throw new Exception($response-&gt;error);
  }
  return $response-&gt;result;
  </code></pre>
  
  <p>and I use json-rpc library that should return that data to the user:</p>
  
  <pre><code>} catch (Exception $e) {
      //catch all exeption from user code
      $msg = $e-&gt;getMessage();
      echo response(null, $id, array("code"=&gt;200, "message"=&gt;$msg));
  }
  </code></pre>
  
  <p>Do I need to write new type of exception or can I do this with normal <code>Exception</code>? I would like to send everything that was thrown in <code>"data" =&gt;</code></p>