I have a Symfony controller which basically checks if requested parameters are in the request, then passes these parameters to a service. The service use Guzzle to call an API, does some things with the result and then passes it back to the controller in order to display a Json with the response.
I have a noob question about the handling of errors, if the Api I call with Guzzle return an error, what is the best solution ?
Solution 1: Should I log the error using the Logger service injected in my own service and return an error to my controller in order to display it.
Solution 2: Should I throw an Exception in the service, catch it in my controller and use the $this->get("Logger") in the controller in order to log the error in log files