I have a Symfony controller that basically checks to see if the requested parameters are in the request, then passes those parameters to the service. The service uses Guzzle to call the API, performs some actions with the result, and then passes it back to the controller to display Json with the response.
I have a noob question about error handling, if Api I call with Guzzle return an error, what is the best solution?
Solution 1: Should I log an error using the Logger service introduced in my own service and return an error to my controller in order to display it.
Solution 2. If I have to throw an exception in the service, catch it in my controller and use $ this-> get ("Logger") in the controller to log the error in the log files.
source
share