show custom error page when APP_DEBUG is false

This commit is contained in:
printempw 2016-12-18 21:59:51 +08:00
parent 70bed0c4c3
commit 2ee71b6d98
5 changed files with 18 additions and 2 deletions

View File

@ -7,7 +7,7 @@
# https://github.com/printempw/blessing-skin-server/wiki/.env-%E5%AD%97%E6%AE%B5%E5%90%AB%E4%B9%89%E8%AF%A6%E8%A7%A3 # https://github.com/printempw/blessing-skin-server/wiki/.env-%E5%AD%97%E6%AE%B5%E5%90%AB%E4%B9%89%E8%AF%A6%E8%A7%A3
# Be sure to disable debug at production environment! # Be sure to disable debug at production environment!
APP_DEBUG = true APP_DEBUG = false
APP_ENV = production APP_ENV = production
# ========================= # =========================

View File

@ -82,7 +82,7 @@ class Handler extends ExceptionHandler
return $this->renderExceptionWithWhoops($e); return $this->renderExceptionWithWhoops($e);
} }
return parent::render($request, $e); return response()->view('errors.brief', ['code' => 0, 'message' => 'cmn']);
} }
/** /**

View File

@ -6,6 +6,9 @@ http:
general: general:
title: Error occurred title: Error occurred
brief:
message: Whoops, looks like something went wrong.
exception: exception:
title: Some errors occurred title: Some errors occurred
code: 'Error code: :code' code: 'Error code: :code'

View File

@ -6,6 +6,9 @@ http:
general: general:
title: 出现错误 title: 出现错误
brief:
message: 哎呀,你似乎触发了一个错误
exception: exception:
title: 出现了一些错误 title: 出现了一些错误
code: 错误码::code code: 错误码::code

View 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.brief.message') }}</p>
@endsection