darsain / laravel-console

In-browser console for Laravel PHP framework.
170 stars 44 forks source link

Fix problem when exception is thrown #26

Closed BigfootPlatform closed 10 years ago

BigfootPlatform commented 10 years ago

Currently, when an exception is thrown in the apllication, the current callback does not behave correctly. The issue comes from the Route::currentRouteName call. Changing the if condition fix the problem for me.

darsain commented 10 years ago

Hmm, how is this different than your last PR #25 ? Why is the Route::currentRouteName() a problem again? :)

Or in other words, when does the issue occur and why is Route::currentRouteName() responsible for it?

BigfootPlatform commented 10 years ago

The problem occurs on every exception thrown by the application. When I report all the errors by writing this: ini_set('display_errors', 1); error_reporting(E_ALL); in my app/start/dev.php and when I make sure to trigger a 404 exception by going to a random wrong url on my application, I got this fatal error: Fatal error: Call to a member function getName() on a non-object in /vendor/laravel/framework/src/Illuminate/Routing/Router.php on line 1410

darsain commented 10 years ago

Yes, I can replicate it. I'll patch it with some error handling tweaks. It's not pretty, but I'm too irritated by trying to catch errors and turn them into valid JSON responses in this environment to sacrifice more time to it :/