This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/application/classes/HTTP/Exception/501.php

35 lines
1.0 KiB
PHP
Raw Normal View History

2013-04-18 08:17:33 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class provides a custom 501 Exception to catch OSB specific errors.
*
* @package OSB
* @category Exceptions
* @author Deon George
* @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html
*/
class HTTP_Exception_501 extends Kohana_HTTP_Exception {
protected $_code = 501;
public function __construct($message='',array $variables=NULL,$code=0) {
parent::__construct($message,$variables,$code);
$response = Response::factory();
$response->status($this->_code);
// @todo This is not working as cleanly as I would like - ie: we shouldnt need to publish the headers ourselves?
header(':', true, 501);
if (Kohana::$config->load('debug')->show_errors)
$response->body(View::factory('errors/501')->set('message',$this->getMessage())->render());
else
$response->body('Dang, something went wrong, tell us how we got here...');
echo $response->render();
exit (501);
}
}
?>