esensi / core

The foundational components of Esensi
MIT License
22 stars 1 forks source link

Default Whoops page instead of the redefined one #19

Closed diegocaprioli closed 7 years ago

diegocaprioli commented 8 years ago

I had issues in some projects with the standard and ugly "Whoops" error page when the TokenMismatchException is thrown, in non debug mode. I could easily achieve the desired effect of displaying the proper page by replacing this line: https://github.com/esensi/core/blob/0.6/src/Exceptions/Handler.php#L146

with:

if ( ($e instanceof ErrorException) or ($e instanceof TokenMismatchException) )

Just wanted to make sure this is ok or I'm missing something here?

dalabarge commented 8 years ago

It would appear that TokenMismatchException extends Exception instead of ErrorException. With Exception being the base class of all exceptions I'm a little hesitant to just swallow them all but I suppose our custom whoops screen is better than the generic one. Let's go ahead and just change the line to if ( $e instanceof Exception ) and update the use headers. We might consider with 1.0 to create a more standard way of handling TokenMistmatchExceptions by redirecting to the previous screen to refresh the token vs. even seeing the error.

dalabarge commented 7 years ago

@diegocaprioli did you ever make this change?

dalabarge commented 7 years ago

Fixed in 0.6