Exceptions are ignored a lot by devs even tho they can be very helpful with tracking the issues, and you can even send an email to devs when a specific exception occurs. Thanks for the video!!
Exactly I wouldn't say I'd love to individually catch all exceptions I prefer it inherits a base exception class that handles all exceptions like that using the render method
I use exceptions then catch them using Laravel’s Error Handing features. It reduced the amount of try/catch blocks. For example if an exception extends an MyApiException then I can choose to always return json, but if it extends MyImageConversionException I may throw an error back to the UI. Another use case is to let exceptions bubble up while in development but only log while in production and provide a generic error like “whoops something went wrong” to the user. If you abort you loose the option to control how errors are handled, and you may have to go back and add exceptions anyways.
Laravel has a neat feature with render functions in custom exceptions. So you are able to throw speaking erros for your API e.g. JSON API conform errors, which are pretty nice. In cli you would still have your call stack and the exception message. Try to avoid try catch blocks in your controllers. Btw a dedicated exceptions with disabled debug (which always should be in production) might be bad for FE devs. They wont see the exception message. Please try to work with granulated exceptions. Generalised catching exceptions/throwables might end in unexpected behaviour. You also can watch fur custom eXceptions in your tests.
While watching your video, just realized that Laravel Validation won't throw any exception. And that made me thinking: why not make a course/series of how Laravel works internally? I mean... inspecting Laravel's source code
There are courses like this, like Laravel Core Adventures by Christoph Rumpel. I don't think it would interest many devs in practice. Also, Laravel would actually throw exception, just handle it automatically.
implementation of abort() in laravel/framework/src/Illuminate/Foundation/helpers.php It throws one of the following exception classes based on conditions: HttpResponseException, HttpResponseException, NotFoundHttpException, HttpException@@LaravelDaily
If you do multiple service actions inside the controller. Should there be one try catch or separate try catches for each sevice action call individualy? So trying multiple stuff and then catch or all separate try catches.