コード例 #1
0
ファイル: AMFException.php プロジェクト: ksecor/civicrm
 /**
  * throwException provides the means to raise an exception.  This method will 
  * stop the further execution of the remote method, but not hault the execution
  * of the entire process.  Using the built in PHP exception system will stop
  * the entire process and not allow us to report very detailed information back
  * to the client, especially if there are multiple methods.
  * 
  * When we upgrade to PHP 5, using the try...catch syntax will make this much easier.
  * 
  * @static
  * @param AMFBody $body The AMFBody object to apply the exception to.
  * @param AMFException @exception The exception object to throw
  * @see AMFBody
  */
 function throwException(&$body, $exception)
 {
     $body->responseURI = $body->responseIndex . "/onStatus";
     $results =& $body->getResults();
     $results["description"] = $exception->description;
     $results["details"] = $exception->details;
     $results["level"] = $exception->level;
     $results["line"] = $exception->line;
     $results["code"] = $exception->code;
 }
コード例 #2
0
 /**
  * throwException provides the means to raise an exception.  This method will 
  * stop the further execution of the remote method, but not hault the execution
  * of the entire process.  Using the built in PHP exception system will stop
  * the entire process and not allow us to report very detailed information back
  * to the client, especially if there are multiple methods.
  * 
  * When we upgrade to PHP 5, using the try...catch syntax will make this much easier.
  * 
  * @static
  * @param AMFBody $body The AMFBody object to apply the exception to.
  * @param AMFException @exception The exception object to throw
  * @see AMFBody
  */
 function throwException(&$body, $exception)
 {
     $body->responseURI = $body->responseIndex . "/onStatus";
     $results =& $body->getResults();
     if ($GLOBALS['amfphp']['encoding'] == 'amf3') {
         $results = new ErrorMessage();
         $results->correlationId = $GLOBALS['amfphp']['lastMessageId'];
         $results->faultCode = $exception->code;
         $results->faultDetail = $exception->details . ' on line ' . $exception->line;
         $results->faultString = $exception->description;
     } elseif ($GLOBALS['amfphp']['encoding'] == 'amf0') {
         $results["description"] = $exception->description;
         $results["details"] = $exception->details;
         $results["level"] = $exception->level;
         $results["line"] = $exception->line;
         $results["code"] = $exception->code;
     } else {
         $results['faultCode'] = $exception->code;
         $results['faultDetail'] = $exception->details . ' on line ' . $exception->line;
         $results['faultString'] = $exception->description;
     }
 }