GCTC-NTGC /
TalentCloud
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace App\Exceptions; |
||||
| 4 | |||||
| 5 | use Exception; |
||||
| 6 | use Illuminate\Support\Facades\Lang; |
||||
| 7 | use Illuminate\Support\Facades\Log; |
||||
| 8 | |||||
| 9 | class AdminException extends Exception |
||||
| 10 | { |
||||
| 11 | /** |
||||
| 12 | * @var $links A collection of links to pass to the view. |
||||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||||
| 13 | */ |
||||
| 14 | private $links; |
||||
| 15 | |||||
| 16 | /** |
||||
| 17 | * Custom constructor to add additional elements to render view. |
||||
| 18 | * |
||||
| 19 | * @param string $message Custom error message. |
||||
| 20 | * @param integer $code HTTP code to return. |
||||
| 21 | * @param \Throwable $previous The last exception thrown. |
||||
| 22 | * @param string[] $links A collection of links to send to the view. |
||||
| 23 | * |
||||
| 24 | * @return void |
||||
| 25 | */ |
||||
| 26 | public function __construct(string $message, int $code, ?\Throwable $previous = null, array $links = null) |
||||
| 27 | { |
||||
| 28 | $this->links = $links; |
||||
| 29 | parent::__construct($message, $code, $previous); |
||||
| 30 | } |
||||
| 31 | |||||
| 32 | /** |
||||
| 33 | * Render the exception into an HTTP response. |
||||
| 34 | * |
||||
| 35 | * @param \Illuminate\Http\Request $request Incoming request object. |
||||
| 36 | * @return \Illuminate\Http\Response|\Illuminate\Contracts\Routing\ResponseFactory |
||||
| 37 | */ |
||||
| 38 | public function render(\Illuminate\Http\Request $request) |
||||
|
0 ignored issues
–
show
The parameter
$request is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 39 | { |
||||
| 40 | return response()->view( |
||||
|
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 41 | 'errors/admin', |
||||
| 42 | [ |
||||
| 43 | 'exception' => $this, |
||||
| 44 | 'error' => [ |
||||
| 45 | 'title' => Lang::get('errors.title'), |
||||
| 46 | ], |
||||
| 47 | 'links' => $this->links |
||||
| 48 | ], |
||||
| 49 | 500 |
||||
| 50 | ); |
||||
| 51 | } |
||||
| 52 | |||||
| 53 | /** |
||||
| 54 | * Override, custom exception doesn't return a status code. |
||||
| 55 | * |
||||
| 56 | * @return mixed |
||||
| 57 | */ |
||||
| 58 | public function getStatusCode() |
||||
| 59 | { |
||||
| 60 | return 500; |
||||
| 61 | } |
||||
| 62 | } |
||||
| 63 |