Skip to content
Snippets Groups Projects
Commit c0d7fbdd authored by Kevin Abel's avatar Kevin Abel
Browse files

Allow the entry and controller to output exceptions

parent 245c51e2
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,12 @@ class Controller ...@@ -47,7 +47,12 @@ class Controller
} }
} }
public function getURL() public function outputException(\Exception $e)
{
$this->output = $e;
}
public static function getURL()
{ {
return self::$url; return self::$url;
} }
......
...@@ -11,6 +11,12 @@ if (file_exists(__DIR__ . '/../config.inc.php')) { ...@@ -11,6 +11,12 @@ if (file_exists(__DIR__ . '/../config.inc.php')) {
} }
require_once $config_file; require_once $config_file;
if (PHP_VERSION_ID < 50600) {
iconv_set_encoding('internal_encoding', 'UTF-8');
iconv_set_encoding("output_encoding", 'UTF-8');
} else {
ini_set('default_charset', 'UTF-8');
}
use RegExpRouter as RegExpRouter; use RegExpRouter as RegExpRouter;
...@@ -31,4 +37,10 @@ $savvy = new OutputController($catalog->options); ...@@ -31,4 +37,10 @@ $savvy = new OutputController($catalog->options);
$savvy->addGlobal('controller', $catalog); $savvy->addGlobal('controller', $catalog);
$savvy->addGlobal('course_search_driver', new CourseSearch\DBSearcher()); $savvy->addGlobal('course_search_driver', new CourseSearch\DBSearcher());
$savvy->sendCORSHeaders(strtotime('tomorrow')); $savvy->sendCORSHeaders(strtotime('tomorrow'));
try {
echo $savvy->render($catalog); echo $savvy->render($catalog);
} catch (\Exception $e) {
$catalog->outputException($e);
echo $savvy->render($catalog);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment