I'm using Rollbar in a Laravel 5.7 app, and the following situation has been confusing and frustrating me.
It seems that my \app\Exceptions\Handler.php file isn't getting used normally.
I finally noticed that https://docs.rollbar.com/docs/laravel#section-exception-logging says:
"For Laravel 5.6, all errors which are normally handled by \App\Exceptions\Handler are going to be reported to Rollbar by default."
How can I disable this default functionality?
My \app\Exceptions\Handler.php will use Log to send data to Rollbar too, but it's important for me to run my whole exception handler since there is other functionality in there that needs to happen first.
Thanks.
Related
I have an "/x" api endpoint that dispatches a "MakeXJob" Job (without ShouldQueue). In local environment without Octane, it works just fine. But in Server with Octane (Swoole), does not dispatching the job. I am dispatching in command line with tinker (to see if there is a problem), and it works expected again.
Has anyone encountered such a problem before? This is the second Octane(!) related issue I faced. Of course I am not sure if they are "Octane" related, it's just an idea.
Here is other issue: Laravel Request Class prepareForValidation not reflected in $request->get()
In Laravel, why do I use assertSessionHasErrors() in order to check if there was an error?
I used this in my feature testing to make sure there is a validation error and it worked, but I don't get why an error is in a session even though I haven't added anything to the session. Do errors go into the session of a response? Can anyone explain this?
According Lavavel doc:
https://laravel.com/docs/8.x/validation#quick-displaying-the-validation-errors
In addition, all of the validation errors and request input will automatically be flashed to the session.
I really don't like the new exception screen in laravel 6. Is there a way to switch it back to the one from 5.8?
Whoops is the old error handler, try to install it and register a new handler, there is one example here: How can I register custom error handler in laravel 5?
Find instructions how to install and use whoops here https://github.com/filp/whoops
PS: just be careful, this handler should be executes only on development environment
So I has a small problem as I outlined here.
I have made a new question because this is more general and will perhaps help others.
So essentially, I integrated the Facebook SDK Into Codeigniter as a library.
The SDK requires Json and Curl.
In the base_facebook.php file there is the following code:
if (!function_exists('curl_init')) {
throw new Exception('Facebook needs the CURL PHP extension.');
}
if (!function_exists('json_decode')) {
throw new Exception('Facebook needs the JSON PHP extension.');
}
If these functions are not available I expect an error to be fired to tell me such. Then I can install the correct packages and continue.
What actually happened is that even when I had error reporting set to E_ALL a blank page was returned.
This made it impossible to debug and after lots of playing I worked out it was because CURL was not installed on my server.
My question is why does codeigniter show blank pages rather than library based exceptions?
Furthermore even if there is an exception in a library why does the rest of the page not continue executing.
Essentially CI is seemingly making the use of exceptions worthless..
COuld anyone advise?
THanks
My question is why does codeigniter show blank pages rather than library based exceptions?
Most likely because display_errors is set to “off”.
While this is recommended for a production environment (web site users are not supposed to see internal error messages – it might give them info about internals, that they are not supposed to have) – it’s not very helpful while developing, where you as the developer want to be informed about what went wrong.
So check if CI has a “debug” setting for this, or if it’s maybe already set to off in your PHP configuration.
(Maybe CI or your config are set up in a way that errors are logged to a file instead. Also recommended for production; while developing, you’d have to keep an eye on this file then.)
Furthermore even if there is an exception in a library why does the rest of the page not continue executing.
Because that’s how exceptions are supposed to work – if they are not being caught when they reach the “top level” of your app, they cause a fatal error, and scripts die when those occur.
Familiarize yourself with the concept of try { … } catch(…) { … } to handle exceptions that might occur in script flow.
(Actually, it’s kinda surprising you don’t know all this already, if you’re working with an advanced PHP framework …)
I am supporting an application that has some DWR components. Whenever there is a server error i get a javascript alert that simply says 'error'.
Does anyone know where this might be configured and if there is a way to disable this. Id rather it silently fail at whatever then do this very distracting message.
Use DWR exception handlers in the positions wherever there is a chance for run time errors.
Use try catch mechanism and printstacktrace() in catch block. It works for me!