mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 10:41:32 +00:00
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
73 lines
2.2 KiB
PHP
Executable File
73 lines
2.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Streamline\Exceptions;
|
|
|
|
use Illuminate\Auth\AuthenticationException;
|
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
|
use Throwable;
|
|
|
|
class Handler extends ExceptionHandler {
|
|
|
|
/**
|
|
* A list of the exception types that should not be reported.
|
|
*
|
|
* @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,
|
|
];
|
|
|
|
/**
|
|
* Report or log an exception.
|
|
*
|
|
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
|
*
|
|
* @param Throwable $exception
|
|
* @return void
|
|
*/
|
|
public function report(Throwable $exception) {
|
|
parent::report($exception);
|
|
}
|
|
|
|
/**
|
|
* Render an exception into an HTTP response.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param Throwable $exception
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function render($request, Throwable $exception) {
|
|
|
|
if ($exception instanceof \Spatie\Permission\Exceptions\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);
|
|
}
|
|
|
|
/**
|
|
* Convert an authentication exception into an unauthenticated response.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Illuminate\Auth\AuthenticationException $exception
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
protected function unauthenticated($request, AuthenticationException $exception) {
|
|
if ($request->expectsJson()) {
|
|
return response()->json(['error' => 'Unauthenticated.'], 401);
|
|
}
|
|
|
|
return redirect()->guest(url('/'));//
|
|
}
|
|
|
|
}
|