Handling Exceptions and Errors in Laravel

  • 8 lessons
  • 5763 words

This content is available only for premium members.

About this course

Quite often, I get questions like these:

  • When do we need to use the try/catch blocks in Laravel?
  • What do we put inside of that "catch"?
  • How to return a friendly error message to a user in that case?
  • etc.

Our goal is to avoid this shown to the user:

Handling Exceptions and errors gracefully is one of the most "forgotten" parts of developer work, in my opinion.

So, in this course, I will show you examples of how you can handle Exceptions thrown by Laravel and 3rd party packages.

Also, you will learn how (and WHY) to create your own Exception classes.

We will also talk about the following:

  • Logging errors
  • DB transactions
  • Returning friendly errors from Laravel API
  • and more.

The first few lessons are free, so let's dive into the first lesson with practical examples of try/catch!