mirror of
https://github.com/flarum/core.git
synced 2025-08-24 00:53:27 +02:00
Apply fixes from StyleCI
[ci skip] [skip ci]
This commit is contained in:
committed by
Alexander Skvortsov
parent
7035625899
commit
5eff7b010d
@@ -10,9 +10,9 @@
|
|||||||
namespace Flarum\Foundation\ErrorHandling;
|
namespace Flarum\Foundation\ErrorHandling;
|
||||||
|
|
||||||
use Flarum\Frontend\Controller;
|
use Flarum\Frontend\Controller;
|
||||||
use Flarum\Http\Content\PermissionDenied;
|
|
||||||
use Flarum\Http\Content\NotAuthenticated;
|
use Flarum\Http\Content\NotAuthenticated;
|
||||||
use Flarum\Http\Content\NotFound;
|
use Flarum\Http\Content\NotFound;
|
||||||
|
use Flarum\Http\Content\PermissionDenied;
|
||||||
use Flarum\Settings\SettingsRepositoryInterface;
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
use Illuminate\Contracts\Container\Container;
|
use Illuminate\Contracts\Container\Container;
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
@@ -56,15 +56,13 @@ class FrontendFormatter implements HttpFormatter
|
|||||||
|
|
||||||
public function format(HandledError $error, Request $request): Response
|
public function format(HandledError $error, Request $request): Response
|
||||||
{
|
{
|
||||||
$frontend = $this->container->make("flarum.frontend.forum");
|
$frontend = $this->container->make('flarum.frontend.forum');
|
||||||
|
|
||||||
if ($error->getStatusCode() === 401) {
|
if ($error->getStatusCode() === 401) {
|
||||||
$frontend->content(new NotAuthenticated);
|
$frontend->content(new NotAuthenticated);
|
||||||
}
|
} elseif ($error->getStatusCode() === 403) {
|
||||||
elseif ($error->getStatusCode() === 403) {
|
|
||||||
$frontend->content(new PermissionDenied);
|
$frontend->content(new PermissionDenied);
|
||||||
}
|
} elseif ($error->getStatusCode() === 404) {
|
||||||
elseif ($error->getStatusCode() === 404) {
|
|
||||||
$frontend->content(new NotFound);
|
$frontend->content(new NotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,9 +16,9 @@ use Flarum\Settings\SettingsRepositoryInterface;
|
|||||||
use Flarum\User\User;
|
use Flarum\User\User;
|
||||||
use Flarum\User\UsernameSlugDriver;
|
use Flarum\User\UsernameSlugDriver;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use Flarum\Foundation\ErrorHandling\FrontendFormatter;
|
||||||
use Flarum\Foundation\ErrorHandling\Registry;
|
use Flarum\Foundation\ErrorHandling\Registry;
|
||||||
use Flarum\Foundation\ErrorHandling\Reporter;
|
use Flarum\Foundation\ErrorHandling\Reporter;
|
||||||
use Flarum\Foundation\ErrorHandling\FrontendFormatter;
|
|
||||||
use Flarum\Foundation\ErrorHandling\WhoopsFormatter;
|
use Flarum\Foundation\ErrorHandling\WhoopsFormatter;
|
||||||
use Flarum\Http\Exception\RouteNotFoundException;
|
use Flarum\Http\Exception\RouteNotFoundException;
|
||||||
use Flarum\User\Exception\NotAuthenticatedException;
|
use Flarum\User\Exception\NotAuthenticatedException;
|
||||||
|
@@ -76,10 +76,9 @@ class HandleErrors implements Middleware
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$handled) {
|
if (! $handled) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$error = $this->registry->handle($e);
|
$error = $this->registry->handle($e);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user