/** * Throw an exception, depending on its forge identifier * * FIXME : Reimplemet method * * @param string $model * @param array $params * @throws Nova_Core_ExceptionAbstract */ public static function throwException($exception, $message = NULL, $_ = NULL) { if (isset(self::$_exceptionClassCache[$exception])) { $className = self::$_exceptionClassCache[$exception]; } else { Nova::profilerStart("CORE.EXCEPTION.LOAD " . __METHOD__ . " [{$exception}]"); $exceptionConfig = explode('/', $exception); if (count($exceptionConfig) === 1) { $className = $exception; } else { Nova::profilerStart("CORE.EXCEPTION.CONFIG.LOAD"); if (is_null(self::$_exceptionsConfig)) { self::$_exceptionsConfig = new Zend_Config(self::app()->getConfig('global.exceptions')); } $config = self::$_exceptionsConfig->get($exceptionConfig[0]); if (!$config) { $className = 'Exception'; } else { if ($config->get('rewrite') && $config->get('rewrite')->get($exceptionConfig[1])) { $className = $config->get('rewrite')->get($exceptionConfig[1]); } else { $className = $config->get('class') . self::_translateClassName($classSuffix); } } Nova::profilerStop("CORE.EXCEPTION.CONFIG.LOAD"); } self::$_exceptionClassCache[$exception] = $className; Nova::profilerStop("CORE.EXCEPTION.LOAD " . __METHOD__ . " [{$exception}]"); } if (!is_null($message)) { $args = func_get_args(); array_shift($args); array_shift($args); $message = vsprintf($message, $args); } throw new $className($message); }