title: Catch exception from guzzle
body: <p>I'm using laravel and I have setup the abstract class method to get response from the various APIs I'm calling. But if the API url is unreachable then it throws an exception. I know I'm missing something. Any help would be great for me. </p>
  
  <pre><code>$offers = [];
      try {
        $appUrl = parse_url($this-&gt;apiUrl);
  
        // Call Api using Guzzle
        $client = new Client('' . $appUrl['scheme'] . '://' . $appUrl['host'] . '' . $appUrl['path']);
  
        if ($appUrl['scheme'] == 'https') //If https then disable ssl certificate
          $client-&gt;setDefaultOption('verify', false);
  
        $request = $client-&gt;get('?' . $appUrl['query']);
        $response = $request-&gt;send();
        if ($response-&gt;getStatusCode() == 200) {
          $offers = json_decode($response-&gt;getBody(), true);
        }
      } catch (ClientErrorResponseException $e) {
        Log::info("Client error :" . $e-&gt;getResponse()-&gt;getBody(true));
      } catch (ServerErrorResponseException $e) {
        Log::info("Server error" . $e-&gt;getResponse()-&gt;getBody(true));
      } catch (BadResponseException $e) {
        Log::info("BadResponse error" . $e-&gt;getResponse()-&gt;getBody(true));
      } catch (\Exception $e) {
        Log::info("Err" . $e-&gt;getMessage());
      }
  
      return $offers;
  </code></pre>