From e1551fa72aade79168f4f21e9d2567df08971150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=A3=20de=20Souza?= Date: Mon, 17 Sep 2012 21:52:40 -0300 Subject: [PATCH 1/2] throw an specific exception on connection errors --- src/Httpful/Exception/ConnectionErrorException.php | 7 +++++++ src/Httpful/Request.php | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/Httpful/Exception/ConnectionErrorException.php diff --git a/src/Httpful/Exception/ConnectionErrorException.php b/src/Httpful/Exception/ConnectionErrorException.php new file mode 100644 index 0000000..4a42974 --- /dev/null +++ b/src/Httpful/Exception/ConnectionErrorException.php @@ -0,0 +1,7 @@ +_error(curl_error($this->_ch)); - throw new \Exception('Unable to connect.'); + throw new ConnectionErrorException('Unable to connect.'); } $info = curl_getinfo($this->_ch); From c2f71e7de27da3baa9a4489863ac69bdacc8f05d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=A3=20de=20Souza?= Date: Mon, 17 Sep 2012 22:04:47 -0300 Subject: [PATCH 2/2] extends from the root exception --- src/Httpful/Exception/ConnectionErrorException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Httpful/Exception/ConnectionErrorException.php b/src/Httpful/Exception/ConnectionErrorException.php index 4a42974..bba73a6 100644 --- a/src/Httpful/Exception/ConnectionErrorException.php +++ b/src/Httpful/Exception/ConnectionErrorException.php @@ -2,6 +2,6 @@ namespace Httpful\Exception; -class ConnectionErrorException extends Exception +class ConnectionErrorException extends \Exception { } \ No newline at end of file