Fixes (#435)
* Add flight level field to PIREP field closes #401 * Default value for distance 0 closes #400 * Block airline deletion if assets exist #367 * Formatting * Move some of the base exception classes * Fix skin references to use settings table * Set default for theme name if setting is wrong
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use App\Exceptions\Converters\GenericException;
|
||||
use App\Exceptions\Converters\NotFound;
|
||||
use App\Exceptions\Converters\GenericExceptionAbstract;
|
||||
use App\Exceptions\Converters\SymfonyException;
|
||||
use App\Exceptions\Converters\ValidationException;
|
||||
use Exception;
|
||||
@@ -33,7 +32,7 @@ class Handler extends ExceptionHandler
|
||||
protected $dontReport = [
|
||||
AuthenticationException::class,
|
||||
AuthorizationException::class,
|
||||
HttpException::class,
|
||||
AbstractHttpException::class,
|
||||
IlluminateValidationException::class,
|
||||
ModelNotFoundException::class,
|
||||
SymfonyHttpException::class,
|
||||
@@ -53,7 +52,7 @@ class Handler extends ExceptionHandler
|
||||
if ($request->is('api/*')) {
|
||||
Log::error('API Error', $exception->getTrace());
|
||||
|
||||
if ($exception instanceof HttpException) {
|
||||
if ($exception instanceof AbstractHttpException) {
|
||||
return $exception->getResponse();
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ class Handler extends ExceptionHandler
|
||||
|
||||
if ($exception instanceof ModelNotFoundException ||
|
||||
$exception instanceof NotFoundHttpException) {
|
||||
$error = new NotFound($exception);
|
||||
$error = new AssetNotFound($exception);
|
||||
return $error->getResponse();
|
||||
}
|
||||
|
||||
@@ -79,11 +78,11 @@ class Handler extends ExceptionHandler
|
||||
return $error->getResponse();
|
||||
}
|
||||
|
||||
$error = new GenericException($exception);
|
||||
$error = new GenericExceptionAbstract($exception);
|
||||
return $error->getResponse();
|
||||
}
|
||||
|
||||
if ($exception instanceof HttpException
|
||||
if ($exception instanceof AbstractHttpException
|
||||
&& $exception->getStatusCode() === 403) {
|
||||
return redirect()->guest('login');
|
||||
}
|
||||
@@ -112,24 +111,25 @@ class Handler extends ExceptionHandler
|
||||
/**
|
||||
* Render the given HttpException.
|
||||
*
|
||||
* @param HttpException $e
|
||||
* @param AbstractHttpException $e
|
||||
*
|
||||
* @return \Illuminate\Http\Response|Response
|
||||
*/
|
||||
protected function renderHttpException(HttpExceptionInterface $e)
|
||||
{
|
||||
Flash::error($e->getMessage());
|
||||
|
||||
$status = $e->getStatusCode();
|
||||
view()->replaceNamespace('errors', [
|
||||
resource_path('views/layouts/'.config('phpvms.skin').'/errors'),
|
||||
resource_path('views/layouts/'.setting('general.theme', 'default').'/errors'),
|
||||
resource_path('views/errors'),
|
||||
__DIR__.'/views',
|
||||
]);
|
||||
|
||||
if (view()->exists("errors::{$status}")) {
|
||||
//if (view()->exists('layouts' . config('phpvms.skin') .'.errors.' .$status)) {
|
||||
return response()->view("errors::{$status}", [
|
||||
'exception' => $e,
|
||||
'SKIN_NAME' => config('phpvms.skin'),
|
||||
'SKIN_NAME' => setting('general.theme', 'default'),
|
||||
], $status, $e->getHeaders());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user