Posts

Showing posts with the label Error

Handling Exceptions in a Symfony Application

There are two main types of application errors: The request can be processed, but the data is not valid The request could not be processed due to a broken part of the application or system If the requested URL is not found because it is not defined in the API specification, then an HTTP 404 (Not Found) response is returned. The request can be processed, but the data is not valid refers to a server response with an HTTP code 400 (Bad Request) detailing exactly which data sent is invalid. Errors of this kind are foreseen in advance and their handling is a normal part of the application. For example, after submitting the news form data to the server, one of the fields did not pass validation and the server returned an HTTP 400 (Bad Request) response with error details to be shown to the user. This type of error can not be logged, because error details are returned immediately with the server response and no server-side fixes are required. This kind of error displays the sa...