diff --git a/src/Monolog/Handler/CubeHandler.php b/src/Monolog/Handler/CubeHandler.php index d968720c..db8e6552 100644 --- a/src/Monolog/Handler/CubeHandler.php +++ b/src/Monolog/Handler/CubeHandler.php @@ -116,7 +116,11 @@ class CubeHandler extends AbstractProcessingHandler $data['data'] = $record['context']; $data['data']['level'] = $record['level']; - $this->{'write'.$this->scheme}(json_encode($data)); + if ($this->scheme === 'http') { + $this->writeHttp(json_encode($data)); + } else { + $this->writeUdp(json_encode($data)); + } } private function writeUdp($data) @@ -140,6 +144,8 @@ class CubeHandler extends AbstractProcessingHandler 'Content-Length: ' . strlen('['.$data.']')) ); - return curl_exec($this->httpConnection); + if (curl_exec($this->httpConnection) === false) { + throw new \RuntimeException(sprintf('Curl error (code %s): %s', curl_errno($ch), curl_error($ch))); + } } } diff --git a/src/Monolog/Handler/MandrillHandler.php b/src/Monolog/Handler/MandrillHandler.php index 60a2901e..6726e1e4 100644 --- a/src/Monolog/Handler/MandrillHandler.php +++ b/src/Monolog/Handler/MandrillHandler.php @@ -63,7 +63,9 @@ class MandrillHandler extends MailHandler 'async' => false, ))); - curl_exec($ch); + if (curl_exec($ch) === false) { + throw new \RuntimeException(sprintf('Curl error (code %s): %s', curl_errno($ch), curl_error($ch))); + } curl_close($ch); } }