Skip to content

Commit

Permalink
Merge pull request weiboad#30 from Crim/SocketConnectException
Browse files Browse the repository at this point in the history
use new exception for connection errors

Thanks @Crim
  • Loading branch information
nmred committed Sep 6, 2015
2 parents b30f3fc + 2f32ab8 commit 06817c9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/Kafka/Exception/SocketConnect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
// +---------------------------------------------------------------------------
// | SWAN [ $_SWANBR_SLOGAN_$ ]
// +---------------------------------------------------------------------------
// | Copyright $_SWANBR_COPYRIGHT_$
// +---------------------------------------------------------------------------
// | Version $_SWANBR_VERSION_$
// +---------------------------------------------------------------------------
// | Licensed ( $_SWANBR_LICENSED_URL_$ )
// +---------------------------------------------------------------------------
// | $_SWANBR_WEB_DOMAIN_$
// +---------------------------------------------------------------------------

namespace Kafka\Exception;

use \Kafka\Exception;

/**
+------------------------------------------------------------------------------
* Kafka php client exception
+------------------------------------------------------------------------------
*
* @package
* @version $_SWANBR_VERSION_$
* @copyright Copyleft
* @author $_SWANBR_AUTHOR_$
+------------------------------------------------------------------------------
*/

class SocketConnect extends Socket
{
}
2 changes: 1 addition & 1 deletion src/Kafka/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function connect()
$error = 'Could not connect to '
. $this->host . ':' . $this->port
. ' ('.$errstr.' ['.$errno.'])';
throw new \Kafka\Exception($error);
throw new \Kafka\Exception\SocketConnect($error);
}

stream_set_blocking($this->stream, 0);
Expand Down

0 comments on commit 06817c9

Please sign in to comment.