Questions tagged [laravel-exceptions]
24 questions
0
votes
0 answers
How may I call a blade view in a custom Http Exception? (Laravel 7)
I am looking to return a view from the HttpException that is triggered by my package's middleware, currently, it returns a static 403 exception and I'd like to change that to a custom view from the package.
I have attempted returning a view in the…

Lewis
- 13
- 2
0
votes
1 answer
Laravel handle PDO Exception message
I'm working on handling exceptions in my Laravel project.
I'm handling them in the Handler like this:
public function render($request, Exception $exception)
{
if ($exception instanceof \Illuminate\Database\Eloquent\ModelNotFoundException) {
…

Federico Arona
- 125
- 1
- 13
0
votes
1 answer
Handle exceptions in laravel without type-checking exceptions in the exception handler's render method and without defining custom exception?
I'm handling laravel exceptions such as NotFoundHttpException and UnauthorizedException by type-checking exceptions in the exception handler's render method, making a lot of instanceof checks which in my opinion violates OCP (open for extension…

Monica Magdy
- 19
- 3
0
votes
2 answers
What triggers the "Trying to get property of non-object" error
Since I started with my first Laravel project I've been having the error
Trying to get property 'column_name' of non-object nonstop, and most of the time I've been able to fix it one way or another, but the problem is, I have no idea of why I get…

AEinarr Krigsson
- 88
- 2
- 9
0
votes
3 answers
Laravel try catch not working, cant catch exception from a package
I am using a package https://github.com/barbushin/php-imap to read email from mail server, I have the following code
$folder = Storage::disk('local')->getAdapter()->getPathPrefix();
try {
$mailbox = new…

Joyal
- 2,587
- 3
- 30
- 45
0
votes
1 answer
UnexpectedValueException laravel :protocol error
I am doing a project in Laravel 5.6 homestead. I got this error after i ran php artisan cache:config, the command ran successfully but after I ran this command and refreshed the url in my browser, I get the following error
Now no routes are opening…

Prakash Poudel
- 434
- 1
- 5
- 17
0
votes
2 answers
Laravel 5.5. App facade is not working in the Exception handler
I have such a simplified version of a class
class Handler extends ExceptionHandler
{
protected $dontReport = [];
public function report(Exception $exception)
{
$environment = \App::environment();
//...
}
…

D.R.
- 2,540
- 3
- 24
- 49
0
votes
3 answers
How to handle native exception in Laravel?
For example, I use:
return User::findOrFail($id);
When row does not exist with $id I get exception.
How I can return this exception in Json response? It returns HTML Laravel page now.
I need something like as:
{"error", "No query results for…

Dev
- 1,013
- 7
- 15
- 37
-1
votes
1 answer
Laravel Error in Logs Doesn't Tell Me What I Need to Fix
I'm getting an error in my Laravel logs almost everyday, but the error message doesn't tell me which one of my views or controllers is causing the error. It's a FormRequest.php error, so I know it's a form validation error. The problem is my site…

GTS Joe
- 3,612
- 12
- 52
- 94