mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to address issues observed during initial testing. These files have been updated in order to generate a new set of app images.
This commit is contained in:
@@ -2,24 +2,34 @@
|
||||
|
||||
namespace Streamline\Exceptions;
|
||||
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use Illuminate\Auth\AuthenticationException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Spatie\Permission\Exceptions\UnauthorizedException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler {
|
||||
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
* A list of the exception types that should not be logged in the log file
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
\Illuminate\Auth\AuthenticationException::class,
|
||||
\Illuminate\Auth\Access\AuthorizationException::class,
|
||||
\Symfony\Component\HttpKernel\Exception\HttpException::class,
|
||||
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
|
||||
\Illuminate\Session\TokenMismatchException::class,
|
||||
\Illuminate\Validation\ValidationException::class,
|
||||
AuthenticationException::class,
|
||||
AuthorizationException::class,
|
||||
HttpException::class,
|
||||
ModelNotFoundException::class,
|
||||
TokenMismatchException::class,
|
||||
ValidationException::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -27,46 +37,47 @@ class Handler extends ExceptionHandler {
|
||||
*
|
||||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
||||
*
|
||||
* @param Throwable $exception
|
||||
* @param Throwable $e
|
||||
* @return void
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function report(Throwable $exception) {
|
||||
parent::report($exception);
|
||||
public function report(Throwable $e): void
|
||||
{
|
||||
parent::report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Throwable $exception
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @param Throwable $e
|
||||
* @return Response | RedirectResponse
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function render($request, Throwable $exception) {
|
||||
|
||||
if ($exception instanceof \Spatie\Permission\Exceptions\UnauthorizedException) {
|
||||
|
||||
public function render($request, Throwable $e): Response|RedirectResponse
|
||||
{
|
||||
if ($e instanceof UnauthorizedException) {
|
||||
flash('Access to that page is restricted. Contact system administrator.')->error();
|
||||
return redirect()->back();
|
||||
|
||||
// return response()->json(['Access to this page is restricted. Please contact system administrator.']);
|
||||
}
|
||||
|
||||
return parent::render($request, $exception);
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an authentication exception into an unauthenticated response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Auth\AuthenticationException $exception
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Request $request
|
||||
* @param AuthenticationException $exception
|
||||
* @return RedirectResponse | JsonResponse
|
||||
*/
|
||||
protected function unauthenticated($request, AuthenticationException $exception) {
|
||||
protected function unauthenticated($request, AuthenticationException $exception): JsonResponse|RedirectResponse
|
||||
{
|
||||
if ($request->expectsJson()) {
|
||||
return response()->json(['error' => 'Unauthenticated.'], 401);
|
||||
}
|
||||
|
||||
return redirect()->guest(url('/'));//
|
||||
return redirect()->guest(url('/'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user