mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 20:22:07 +00:00
Small code optimizations in Exceptions.
This commit is contained in:
@@ -20,6 +20,8 @@
|
|||||||
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @noinspection MultipleReturnStatementsInspection */
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace FireflyIII\Exceptions;
|
namespace FireflyIII\Exceptions;
|
||||||
@@ -39,32 +41,16 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
*/
|
*/
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* A list of the inputs that are never flashed for validation exceptions.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $dontFlash
|
|
||||||
= [
|
|
||||||
'password',
|
|
||||||
'password_confirmation',
|
|
||||||
];
|
|
||||||
/**
|
|
||||||
* A list of the exception types that are not reported.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $dontReport
|
|
||||||
= [
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render an exception into an HTTP response.
|
* Render an exception into an HTTP response.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @param \Exception $exception
|
* @param Exception $exception
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function render($request, Exception $exception)
|
public function render($request, Exception $exception)
|
||||||
{
|
{
|
||||||
@@ -130,18 +116,10 @@ class Handler extends ExceptionHandler
|
|||||||
{
|
{
|
||||||
|
|
||||||
$doMailError = env('SEND_ERROR_MESSAGE', true);
|
$doMailError = env('SEND_ERROR_MESSAGE', true);
|
||||||
if (
|
// if the user wants us to mail:
|
||||||
// if the user wants us to mail:
|
if (true === $doMailError
|
||||||
$doMailError === true
|
// and if is one of these error instances
|
||||||
&& (
|
&& ($exception instanceof FireflyException || $exception instanceof ErrorException || $exception instanceof OAuthServerException)) {
|
||||||
// and if is one of these error instances
|
|
||||||
$exception instanceof FireflyException
|
|
||||||
|| $exception instanceof ErrorException
|
|
||||||
|| $exception instanceof OAuthServerException
|
|
||||||
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
// then, send email
|
|
||||||
$userData = [
|
$userData = [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'email' => 'unknown@example.com',
|
'email' => 'unknown@example.com',
|
||||||
|
Reference in New Issue
Block a user