/** * Call an error-handler function and update the status of a request to ERROR * * @param string $ticket * @param integer $errnum The error number from QuickBooks (see the QuickBooks SDK/IDN for a list of error codes) * @param string $errmsg The error message from QuickBooks * @param string $requestID * @param string $action * @param mixed $ident * @param array $extra * @param string $err * @param string $xml * @param array $qb_identifiers */ protected function _handleError($ticket, $errnum, $errmsg, $requestID, $action, $ident, $extra, &$err, $xml = '', $qb_identifiers = array()) { // , $requestID, $user, $action, $ident, $extra, &$err, $xml, $qb_identifier // Call the error handler (if one is set) // First, set the status of the item to error if ($action and $ident) { $this->_driver->queueStatus($ticket, $action, $ident, QUICKBOOKS_STATUS_ERROR, $errnum . ': ' . $errmsg); } // Log the last error (for the ticket) $this->_driver->errorLog($ticket, $errnum, $errmsg); $this->_driver->log('Attempting to handle error: ' . $errnum . ', ' . $errmsg); // By default, we don't want to continue if the error is not handled $continue = false; // Get username of user which experienced the error $user = $this->_driver->authResolve($ticket); // CALL THE ERROR HANDLER $err = ''; $continue = QuickBooks_Callbacks::callErrorHandler($this->_driver, $this->_onerror, $errnum, $errmsg, $user, $action, $ident, $extra, $err, $xml, $this->_callback_config); // $Driver, $errmap, $errnum, $errmsg, $user, $action, $ident, $extra, &$errerr, $xml, $callback_config if ($err) { // Log error messages returned by the error handler $this->_driver->log('An error occured while handling error: ' . $errnum . ': ' . $errmsg . ': ' . $err, $ticket, QUICKBOOKS_LOG_NORMAL); $this->_driver->errorLog($ticket, QUICKBOOKS_ERROR_HANDLER, $err); } // Log the last error (for the log) $this->_driver->log('Handled error: ' . $errnum . ': ' . $errmsg . ' (handler returned: ' . $continue . ')', $ticket, QUICKBOOKS_LOG_NORMAL); // Update the queue status if ($action and $ident) { if ($continue) { $this->_driver->queueStatus($ticket, $action, $ident, QUICKBOOKS_STATUS_HANDLED, $errnum . ': ' . $errmsg); } } return $continue; }