Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] create a view for whoops errors instead of the currently hard coded #14137

Closed
ctf0 opened this issue Jun 25, 2016 · 21 comments
Closed

Comments

@ctf0
Copy link

ctf0 commented Jun 25, 2016

can you please 🙏 create a view for the whoops page like the included 503 view instead of the currently hard coded in vendor/symfony/debug/ExceptionHandler.php so the user can easily edit it without to much trouble ?

@spencerdeinum
Copy link
Contributor

@ctf0
Copy link
Author

ctf0 commented Jun 25, 2016

this doesn't fix the issue because most of the errors are handled through that view, so to override it you will have to write the error exception one by one, this error basically handle anything other than the 404., check the original method to get a better idea.

if am wrong plz correct me 👍

@spencerdeinum
Copy link
Contributor

You can write a different error page for each status code.

I thought that was what you wanted.

Otherwise you can just write your own exception handler and decide whether or not to pass it to the base class or handle it yourself, see (https://laravel.com/docs/5.2/errors#the-exception-handler)

@ctf0
Copy link
Author

ctf0 commented Jun 25, 2016

what i wanted is to have a default error view that i can modify anyway it fits the app, and if i still need to make something in specific for one type of the errors then am still free to do so, but having that god forsaken whoops page popping up in each app gets created with the framework is simply non-sense 😞 .

@stefanoruth
Copy link
Contributor

How about overwriting the decorate method in the app/exceptions/handler.php?

@ctf0
Copy link
Author

ctf0 commented Jun 25, 2016

i believe it wont make a difference because of the original method

vendor/symfony/debug/ExceptionHandler @ getContent

which have the whoops msg.

@crynobone
Copy link
Member

    /**
     * Convert the given exception into a Response instance.
     *
     * @param \Exception $e
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    protected function convertExceptionToResponse(Exception $e)
    {
        $debug = config('app.debug', false);

        if (!! $debug) {
            $e = FlattenException::create($e);
            $handler = new SymfonyExceptionHandler(config('app.debug'));
            $decorated = $this->decorate($handler->getContent($e), $handler->getStylesheet($e));

            return SymfonyResponse::create($decorated, $e->getStatusCode(), $e->getHeaders());
        }

        return response()->view('errors.error', ['exception' => $e], 500);
    }

@GrahamCampbell
Copy link
Member

You can use something like https://github.com/GrahamCampbell/Laravel-Exceptions.

@ctf0
Copy link
Author

ctf0 commented Jun 26, 2016

@GrahamCampbell am already using it in local, but in production am using bug snag which as far as i know doesn't have the same flexibility , or does it ?

@GrahamCampbell
Copy link
Member

It is very flexible in production too. https://styleci.io/ uses it in production.

@GrahamCampbell
Copy link
Member

We also use Bugsnag for logging errors.

@GrahamCampbell
Copy link
Member

In order to use Bugsnag, you don't need to use their laravel package. You can use https://github.com/AltThree/Bugsnag along with https://github.com/AltThree/Logger.

@GrahamCampbell
Copy link
Member

I'm working on getting their next laravel package to use psr loggers rather than overriding the exception handler actually.

@GrahamCampbell
Copy link
Member

My exception package is absolutely designed for production use. The fact it has application in development is purely a consequence of the design used. It's transformer and displayer system is very powerful.

@ctf0
Copy link
Author

ctf0 commented Jun 26, 2016

actually the only reason am using bugsnag is to get notified when something happens and trace the error from their dashboard, if ur package offers the same i would be extremely happy to go with it instead 👍 ,
actually i thought u were the maintainer of the bugsnag package because of ur last commit,

anyhow can u make a small guide on how to implement the AltThree packages, specially i don't know where i would add the bugsnag key or should i replace the default exception handler with something else or not, etc...

@GrahamCampbell
Copy link
Member

actually i thought u were the maintainer of the bugsnag package because of ur last commit,

Well, actually, I am for now. I'm working for Bugsnag for 12 weeks. ;)

@GrahamCampbell
Copy link
Member

Getting the alt-three logging packages set up is pretty easy. Here is my config from StyleCI itself:

image

image

Make sure you regiser the alt-three service providers too. Note that you don't need the "logify" line. That's our private logging system. You'll just need "logger" and "bugsnag".

@ctf0
Copy link
Author

ctf0 commented Jun 26, 2016

awesome 💯 and for the exception handler, it will be https://github.com/GrahamCampbell/Laravel-Exceptions. right ?

@GrahamCampbell
Copy link
Member

Yes. :)

@ctf0
Copy link
Author

ctf0 commented Jun 26, 2016

sweet, many thanx gc 🤘

@GrahamCampbell
Copy link
Member

No problem. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants