Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

SymfonyCasts

Symfony RESTful API: Errors (Course 2)

via SymfonyCasts

Overview

In course 1, we added our basic endpoints with some nice tests (yes!).

Now, we turn to a huge part of APIs: handling and returning consistent errors. Seriously, this is more important than you might think - which is why we're covering this in episode 2.

So, let's handle errors, and let's do it gracefully:

  • Handling Form Validation errors and response
  • Disabling csrf_protection
  • Introducing the api-problem JSON format
  • Exception Listener!
  • Consistent errors everywhere: 404's, 500's, oh my!
  • Handling "extra fields" in your form

Syllabus

  • Validation Errors Test
  • Sending back Validation Errors
  • PUT Validation and CSRF Tokens
  • 99 api/problem+json(s)
  • Modeling the Error: ApiProblem Class
  • Keeping Problem types Consistent
  • The All-Important HttpExceptionInterface
  • Creating the Invalid JSON ApiProblem, and then...
  • ApiProblemException
  • Request Format: Why Exceptions Return HTML
  • Global RESTful Exception Handling
  • Handling 404's + other Errors
  • The Helpful Detail Key
  • Debugging and Cleanup

Taught by

Ryan Weaver and Leanna Pelham

Reviews

Start your review of Symfony RESTful API: Errors (Course 2)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.