Laravel5 Installing whoops Error Manager

Source: Internet
Author: User

How to install "Nice whoops-style error processor" in Laravel5, and tell you how to use it in Laravel5

1, first, composer require file/whoops:~1.0.

2. Then open app/exception/handler.php and add a whoops-style handle to the render () method as follows:

/** * Render An exception to an HTTP response. *     *@param \illuminate\http\request $request *@param \exception $e *@return \illuminate\http\response * *PublicfunctionRender($request, Exception $e) {if ($this->ishttpexception ($e)) {return $this->renderhttpexception ($e); }if (config (' App.debug ')) {return $this->renderexceptionwithwhoops ($e);} return Parent::render ($request, $e);} /** * Render an exception using whoops. * * @param \exception $e * @return \illuminate\http\response */ PR otected function renderexceptionwithwhoops(Exception $e) {$whoops = new \whoops\run; $whoops Pushhandler (new \whoops\handler\prettypagehandler ()); return new \illuminate\http\response ($whoops->handleexception ($e), $e->getstatuscode (), $e- Getheaders ()); }

3, it is so simple

Address of the original: https://mattstauffer.co/blog/bringing-whoops-back-to-laravel-5

Laravel5 Installing whoops Error Manager

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.