2016-08-29 19:47:30 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Exceptions;
|
|
|
|
|
|
|
|
class PrettyPageException extends \Exception
|
|
|
|
{
|
2016-09-04 17:05:30 +08:00
|
|
|
/**
|
|
|
|
* Custom error handler
|
|
|
|
*
|
|
|
|
* @param string $message
|
|
|
|
* @param integer $code
|
|
|
|
* @param boolean $render, to show a error page
|
|
|
|
*/
|
|
|
|
function __construct($message = "Error occured.", $code = -1, $render = false)
|
|
|
|
{
|
|
|
|
parent::__construct($message, $code);
|
2016-08-29 19:47:30 +08:00
|
|
|
|
2016-09-04 17:05:30 +08:00
|
|
|
if ($render)
|
|
|
|
$this->showErrorPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
private function showErrorPage()
|
|
|
|
{
|
|
|
|
echo \View::make('errors.e')->with('code', $this->code)
|
|
|
|
->with('message', $this->message)
|
|
|
|
->render();
|
|
|
|
exit;
|
|
|
|
}
|
2016-08-29 19:47:30 +08:00
|
|
|
}
|