mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-02-23 14:59:07 +08:00
fix PrettyPageException at setup pages
This commit is contained in:
parent
fa9629e796
commit
5efd875b06
@ -3,6 +3,7 @@
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
use App\Http\Middleware\Internationalization;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Validation\ValidationException;
|
||||
@ -20,7 +21,8 @@ class Handler extends ExceptionHandler
|
||||
protected $dontReport = [
|
||||
HttpException::class,
|
||||
ModelNotFoundException::class,
|
||||
ValidationException::class
|
||||
ValidationException::class,
|
||||
PrettyPageException::class
|
||||
];
|
||||
|
||||
/**
|
||||
@ -50,10 +52,7 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
|
||||
if ($e instanceof PrettyPageException && PHP_SAPI != "cli") {
|
||||
echo \View::make('errors.e')->with('code', $e->getCode())
|
||||
->with('message', $e->getMessage())
|
||||
->render();
|
||||
exit;
|
||||
return $e->showErrorPage();
|
||||
}
|
||||
|
||||
if ($e instanceof HttpException) {
|
||||
|
@ -11,19 +11,18 @@ class PrettyPageException extends \Exception
|
||||
* @param integer $code
|
||||
* @param boolean $render, to show a error page
|
||||
*/
|
||||
function __construct($message = "Error occured.", $code = -1, $render = false)
|
||||
public function __construct($message = "Error occured.", $code = -1, $render = false)
|
||||
{
|
||||
parent::__construct($message, $code);
|
||||
|
||||
if ($render)
|
||||
$this->showErrorPage();
|
||||
if ($render) {
|
||||
$this->showErrorPage()->send();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function showErrorPage()
|
||||
public function showErrorPage()
|
||||
{
|
||||
echo \View::make('errors.e')->with('code', $this->code)
|
||||
->with('message', $this->message)
|
||||
->render();
|
||||
exit;
|
||||
return response()->view('errors.pretty', ['code' => $this->code, 'message' => $this->message]);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
@extends('errors.general')
|
||||
|
||||
@section('title', trans('errors.general.title'))
|
||||
|
||||
@section('content')
|
||||
<h1>{{ trans('errors.error.title') }}</h1>
|
||||
|
||||
<p>{{ trans('error.exception.code', ['code' => $code]) }}</p>
|
||||
<p>{!! trans('error.exception.message', ['message' => $message]) !!}</p>
|
||||
@endsection
|
10
resources/views/errors/pretty.tpl
Normal file
10
resources/views/errors/pretty.tpl
Normal file
@ -0,0 +1,10 @@
|
||||
@extends('errors.general')
|
||||
|
||||
@section('title', trans('errors.general.title'))
|
||||
|
||||
@section('content')
|
||||
<h1>{{ trans('errors.general.title') }}</h1>
|
||||
|
||||
<p>{{ trans('errors.exception.code', ['code' => $code]) }}</p>
|
||||
<p>{!! trans('errors.exception.message', ['msg' => $message]) !!}</p>
|
||||
@endsection
|
@ -58,6 +58,7 @@ foreach ($config['aliases'] as $facade => $class) {
|
||||
(new Illuminate\Filesystem\FilesystemServiceProvider($app))->register();
|
||||
(new Illuminate\Session\SessionServiceProvider($app))->register();
|
||||
(new Illuminate\Encryption\EncryptionServiceProvider($app))->register();
|
||||
(new Devitek\Core\Translation\TranslationServiceProvider($app))->register();
|
||||
|
||||
$request = Symfony\Component\HttpFoundation\Request::createFromGlobals();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-09-14 16:57:37
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-09-14 19:53:22
|
||||
* @Last Modified time: 2016-09-30 23:18:56
|
||||
*/
|
||||
|
||||
function check_table_exists() {
|
||||
@ -20,14 +20,14 @@ function check_table_exists() {
|
||||
}
|
||||
|
||||
function redirect_to($url, $msg = "") {
|
||||
if ($msg !== "") {
|
||||
if (app()->bound('session')) {
|
||||
Session::put('msg', $msg);
|
||||
Session::save();
|
||||
} else {
|
||||
// if ($msg !== "") {
|
||||
// if (app()->bound('session')) {
|
||||
// Session::put('msg', $msg);
|
||||
// Session::save();
|
||||
// } else {
|
||||
$_SESSION['msg'] = $msg;
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!headers_sent()) {
|
||||
header('Location: '.$url);
|
||||
|
Loading…
Reference in New Issue
Block a user