Laravel Pro Tips
#exceptions
Another day, another Laravel tip. If you need to catch exceptions and don't want to stop the execution of further code, please make sure you use report(). Make it easy for yourself to log the problems! #laravel #php #phpc
Peter Fox
π₯Laravel Tip Use Laravel's rescue() helper function instead of try / catch with an empty catch block when you want to ignore an expected exception (and avoid ugly code). https://t.co/Vx0nbqcqMT
Shawn π€¦π»ββοΈ Lindstrom
#responses #exceptions
πΆοΈ #Laravel Tip: I like to use the helper functions `abort`, `abort_if`, `abort_unless` to throw HTTP Exceptions. There is also `throw_if` and `throw_unless` to throw a RuntimeException in your code. #PHP #Developers #100Devs
Bilal Haidar
#exceptions #404 #logging
Quick @laravelphp tip: Trying to figure out what is causing an error that isn't in your logs (e.g. a 404)? Temporarily override the `$internalDontReport` array in your exception handler to allow any exceptions to be reported. Run the request again and check your laravel.log
Gilbert Pellegrom π
π‘ A nice, undocumented feature of @laravelphp: you can βmapβ exceptions from one type to another in your exception handler. Nice for converting βdomainβ exceptions to a more appropriate HTTP exception #Laravel
Martin Bean
If you're creating custom exceptions inside your Laravel application, you can add a "context()" method to provide additional data to be printed in the log, as well as a "render()" method to allow the exception to display its own view to the user. Super cool! π€©
Steve Bauman π
No articles were found.