Exceptions in Laravel: Why/How to Use and Create Your Own

preview_player
Показать описание
I see a lot of developers not using Exception classes and try-catch blocks because they don't understand how they actually work under the hood. So, let's learn with an example.

Links mentioned in the video:

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

I think this is much easier to do. The main error handler catches the ModelNotFoundException -> get the model class -> show view.
1. The logic for catching errors is not in the controller or services, but in the handler. You don't need to use try-catch in your code, errors are still passed to the handler. All logic in one place. If you need something special, you can use custom exceptions, the logic for them can also be placed either in the handler or inside the exception.
I do not understand why you need to catch errors not in controllers or services

dbneyik
Автор

Hello sir. Your content is so much meaningful & I'm following you since 2 week ago. Thanks a lot such a beautiful content. It's very helpful to implement in my live projects.

vickymistry
Автор

you pretty much covered all about exceptions in 12 minutes, hats off

bashardlaleh
Автор

Excellent Tutorial!! For some reason, I find your tutorial much easier to follow than those of Jeffrey Way. Often he goes much too fast. Thank you !

vincej
Автор

Thank you for this. As a beginner I was struggling with how to catch and throw exceptions.

MichaelBrown-vqfd
Автор

not knowing English I understood everything he was talking about. Thank you so much for helping my problem ! I subscribe to your channel.Thanks a lot !

deazlylol
Автор

I’ve watched a few of your vids (and subbed) and just want to say you’re a great teacher and I love how you focus on things that can be immediately applied to improve my projects. Thanks!

psyick
Автор

You are my best friend, thanks for lessons.

riowqhl
Автор

Hi sir, It's really smart strong concept logic and very help full, thank you so much.

ShakirAli-hrsc
Автор

Sir you are just awesome, exactly what I was looking for! 👍

sarmadsaqlain
Автор

Most Left out topic. Thanks you covered it. Respect from Pakistan 🇵🇰

nabeelyousafpasha
Автор

Very very awesome and Informative video for a beginner like me. This helped me a lot. Kindly make a short video on "accessors and mutators".

dfordemo
Автор

Thanks as always! Learn, learn, learn!

belce
Автор

You can use the helper report($e) inside catch block to make laravel log the error...

vincolasrj
Автор

Much needed lecture on this topic. Thanks

HassanHafeez
Автор

Hello, Povilas! Thanks for great video! Unfortunately
you did not mention app/Exceptions/Handler.php, while in Laravel documentation this class definitely has main role in error handling... It's not clear how to use it, please make part 2 for this video...

inf
Автор

what an excellent tutorial. Thank you sir and please do more tutorials. Thank you gain.

ravindujeewhantha
Автор

Awesome! Very informative and understandable. I glad that found your channel)

maksympletiuk
Автор

this is extensive knowledge, thank you so much

aagaleon
Автор

Thanks a lot for this video, its help me to understand how its working inside Laravel, keep up the good work :)

pnk