Try-Catch not stopping cURL error 60: SSL certificate problem: Invalid certificate chain exception

Published 3 months ago by jgravois

I am getting an exception in our uptime monitor that is breaking the monitor rather than returning a "false" to trigger a notification and a 'red light' in our dashboard.

I THOUGHT I would handle the exception with the code below but it is not working

public function fetch($path)
    {
        try {
            $response = $this->client->get($path, ['http_errors' => false]);
            return $response->getStatusCode();
        } catch (\GuzzleHttp\Exception\ConnectException $e) {
            Log::error('Received error: ' . $e->getMessage());
            return false;
        } catch (Exception $e) {
            Log::error('Received error: ' . $e->getMessage());
            return false;
        }
    } // end function

Any thoughts?

Please sign in or create an account to participate in this conversation.