mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-30 17:02:04 +08:00 
			
		
		
		
	update: error message
This commit is contained in:
		| @@ -3,7 +3,10 @@ | |||||||
| namespace App\Exceptions; | namespace App\Exceptions; | ||||||
|  |  | ||||||
| use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||||||
|  | use Illuminate\Support\Arr; | ||||||
|  | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | ||||||
| use Throwable; | use Throwable; | ||||||
|  | use Facade\Ignition\Exceptions\ViewException; | ||||||
|  |  | ||||||
| class Handler extends ExceptionHandler | class Handler extends ExceptionHandler | ||||||
| { | { | ||||||
| @@ -50,9 +53,27 @@ class Handler extends ExceptionHandler | |||||||
|      */ |      */ | ||||||
|     public function render($request, Throwable $exception) |     public function render($request, Throwable $exception) | ||||||
|     { |     { | ||||||
|         if ($exception instanceof \Facade\Ignition\Exceptions\ViewException) { |         if ($exception instanceof ViewException) { | ||||||
|             abort(501, '主题初始化发生错误,请在后台对主题检查或配置后重试。'); |             return response([ | ||||||
|  |                 'message' => "主题初始化发生错误,请在后台对主题检查或配置后重试。" | ||||||
|  |             ]); | ||||||
|         } |         } | ||||||
|         return parent::render($request, $exception); |         return parent::render($request, $exception); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     protected function convertExceptionToArray(Throwable $e) | ||||||
|  |     { | ||||||
|  |         return config('app.debug') ? [ | ||||||
|  |             'message' => $e->getMessage(), | ||||||
|  |             'exception' => get_class($e), | ||||||
|  |             'file' => $e->getFile(), | ||||||
|  |             'line' => $e->getLine(), | ||||||
|  |             'trace' => collect($e->getTrace())->map(function ($trace) { | ||||||
|  |                 return Arr::except($trace, ['args']); | ||||||
|  |             })->all(), | ||||||
|  |         ] : [ | ||||||
|  |             'message' => $this->isHttpException($e) ? $e->getMessage() : __("Uh-oh, we've had some problems, we're working on it."), | ||||||
|  |         ]; | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -28,8 +28,12 @@ class ThemeController extends Controller | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         $data = var_export($data, 1); |         $data = var_export($data, 1); | ||||||
|         if (!File::put(base_path() . "/config/theme/{$themeName}.php", "<?php\n return $data ;")) { |         try { | ||||||
|             abort(500, "{$themeName}初始化失败"); |             if (!File::put(base_path() . "/config/theme/{$themeName}.php", "<?php\n return $data ;")) { | ||||||
|  |                 abort(500, "{$themeName}初始化失败"); | ||||||
|  |             } | ||||||
|  |         } catch (\Exception $e) { | ||||||
|  |             abort(500, '请检查V2Board目录权限'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         try { |         try { | ||||||
|   | |||||||
| @@ -88,5 +88,6 @@ | |||||||
|     "The coupon can only be used :limit_use_with_user per person": "The coupon can only be used :limit_use_with_user per person", |     "The coupon can only be used :limit_use_with_user per person": "The coupon can only be used :limit_use_with_user per person", | ||||||
|     "The coupon code cannot be used for this period": "The coupon code cannot be used for this period", |     "The coupon code cannot be used for this period": "The coupon code cannot be used for this period", | ||||||
|     "Request failed, please try again later": "Request failed, please try again later", |     "Request failed, please try again later": "Request failed, please try again later", | ||||||
|     "Register frequently, please try again after 1 hour": "Register frequently, please try again after 1 hour" |     "Register frequently, please try again after 1 hour": "Register frequently, please try again after 1 hour", | ||||||
|  |     "Uh-oh, we've had some problems, we're working on it.": "Uh-oh, we've had some problems, we're working on it." | ||||||
| } | } | ||||||
|   | |||||||
| @@ -88,5 +88,6 @@ | |||||||
|     "The coupon can only be used :limit_use_with_user per person": "该优惠券每人只能用 :limit_use_with_user 次", |     "The coupon can only be used :limit_use_with_user per person": "该优惠券每人只能用 :limit_use_with_user 次", | ||||||
|     "The coupon code cannot be used for this period": "此优惠券无法用于该付款周期", |     "The coupon code cannot be used for this period": "此优惠券无法用于该付款周期", | ||||||
|     "Request failed, please try again later": "请求失败,请稍后再试", |     "Request failed, please try again later": "请求失败,请稍后再试", | ||||||
|     "Register frequently, please try again after 1 hour": "注册频繁,请等待1小时后再次尝试" |     "Register frequently, please try again after 1 hour": "注册频繁,请等待1小时后再次尝试", | ||||||
|  |     "Uh-oh, we've had some problems, we're working on it.": "遇到了些问题,我们正在进行处理" | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user