Reputation: 9383
When my PHP
script goes wrong, I see a nice Whoops
page with all details of the error.
However, sometimes I need to see the output of where it went wrong (for example in a loop with 1 million items, but only 1 of them gives a problem, I need to see which item). I flush the output after each item, so the page behind the Whoops
page shows the last item at the bottom of the page.
Is there a way to hide the Whoops
page (temporarily) ?
Using Chrome DevTools
, I now hide the DIV
that has the class 'Whoops_container
' , but it would be nice if there's a more elegant way.
Upvotes: 0
Views: 252
Reputation: 2525
I created a pull request for adding a "hide-button". You can see the necessary changes here: https://github.com/filp/whoops/pull/579/files
This might help until they integrate it, or if they decide not to integrate it.
Here are the changes extracted from the pull request, to add some value to the link:
src/Whoops/Resources/views/header.html.php (add this below the other Button ("COPY")
<button id="hide-error" class="rightButton" title="Hide error message" onclick="document.getElementsByClassName('Whoops')[0].style.display = 'none';">
HIDE
</button>
src/Whoops/Resources/views/header.html.php (add this on the end)
.rightButton {
cursor: pointer;
border: 0;
opacity: .8;
background: none;
color: rgba(255, 255, 255, 0.1);
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
border-radius: 3px;
outline: none !important;
}
.rightButton:hover {
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
color: rgba(255, 255, 255, 0.3);
}
Upvotes: 0
Reputation: 1412
If error is common you can ingore that globally. For an example ValidationException or ModelNotFoundException then you can ignore that exception.
In Handler.php in Laravel there is an array it's called $dontReport. You can register your exception class here and ingore your exception Globally.
protected $dontReport = [
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Validation\ValidationException::class,
];
You also can write custom output code into render function to handle your exception.
Upvotes: 0