public static function validateFeed($section, $feedData) { if (!self::argVal($feedData, 'TITLE')) { return new KurogoError(1, $this->getLocalizedString('ERROR_NO_TITLE'), $this->getLocalizedString('ERROR_NO_TITLE_DESCRIPTION')); } if (!isset($feedData['MODEL_CLASS'])) { $feedData['MODEL_CLASS'] = self::$defaultModel; } try { $controller = NewsDataModel::factory($feedData['MODEL_CLASS'], $feedData); } catch (KurogoConfigurationException $e) { return KurogoError::errorFromException($e); } return true; }
private function errorHandler($sql, $errorInfo, $ignoreErrors, $catchErrorCodes) { $e = new KurogoDataException(sprintf("Error with %s: %s", $sql, $errorInfo['message']), $errorInfo['code']); if ($ignoreErrors) { $this->lastError = KurogoError::errorFromException($e); return; } // prevent the default error handling mechanism // from triggerring in the rare case of expected // errors such as unique field violations if (in_array($errorInfo[0], $catchErrorCodes)) { return $errorInfo; } Kurogo::log(LOG_WARNING, sprintf("%s error with %s: %s", $this->dbType, $sql, $errorInfo['message']), 'db'); if (Kurogo::getSiteVar('DB_DEBUG')) { throw $e; } }
function exceptionHandlerForAPI(Exception $exception) { $bt = $exception->getTrace(); array_unshift($bt, array('line' => $exception->getLine(), 'file' => $exception->getFile())); Kurogo::log(LOG_ALERT, "A " . get_class($exception) . " has occured: " . $exception->getMessage(), "exception", $bt); $error = KurogoError::errorFromException($exception); $response = new APIResponse(); $response->setVersion(0); $response->setError($error); $response->display(); exit; }
function exceptionHandlerForAPI($exception) { $error = KurogoError::errorFromException($exception); $response = new APIResponse(); $response->setVersion(0); $response->setError($error); $response->display(); }
private function errorHandler($sql, $errorInfo, $ignoreErrors, $catchErrorCodes) { if (Kurogo::getSiteVar('DB_DEBUG')) { $e = new Exception (sprintf("Error with %s: %s", $sql, $errorInfo[2]), $errorInfo[1]); } if ($ignoreErrors) { $this->lastError = KurogoError::errorFromException($e); return; } // prevent the default error handling mechanism // from triggerring in the rare case of expected // errors such as unique field violations if(in_array($errorInfo[0], $catchErrorCodes)) { return $errorInfo; } if (Kurogo::getSiteVar('DB_DEBUG')) { throw $e; } else { error_log(sprintf("Error with %s: %s", $sql, $errorInfo[2])); } }