[WAMP] Errors

Cleaned up error handling and tests. refs #190
This commit is contained in:
Chris Boden 2014-06-07 11:35:54 -04:00
parent f8098db6cc
commit f22f209466
3 changed files with 5 additions and 5 deletions

View File

@ -79,8 +79,8 @@ class ServerProtocol implements MessageComponentInterface, WsServerInterface {
/**
* {@inheritdoc}
* @throws \Exception
* @throws JsonException
* @throws \Ratchet\Wamp\Exception
* @throws \Ratchet\Wamp\JsonException
*/
public function onMessage(ConnectionInterface $from, $msg) {
$from = $this->connections[$from];

View File

@ -39,9 +39,9 @@ class WampServer implements MessageComponentInterface, WsServerInterface {
public function onMessage(ConnectionInterface $conn, $msg) {
try {
$this->wampProtocol->onMessage($conn, $msg);
} catch (Exception $je) {
} catch (Exception $we) {
$conn->close(1007);
} catch (\UnexpectedValueException $uve) {
} catch (JsonException $je) {
$conn->close(1007);
}
}

View File

@ -258,7 +258,7 @@ class ServerProtocolTest extends \PHPUnit_Framework_TestCase {
* @dataProvider badFormatProvider
*/
public function testValidJsonButInvalidProtocol($message) {
$this->setExpectedException('\UnexpectedValueException');
$this->setExpectedException('\Ratchet\Wamp\Exception');
$conn = $this->newConn();
$this->_comp->onOpen($conn);