From fb1ba88fcce876cb49bf80a1b1909317702262d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Mon, 19 May 2014 15:46:18 +0200 Subject: [PATCH] Consistent Exception handling for WAMP protocol errors --- src/Ratchet/Wamp/ServerProtocol.php | 4 ++-- src/Ratchet/Wamp/WampServer.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ratchet/Wamp/ServerProtocol.php b/src/Ratchet/Wamp/ServerProtocol.php index 0a5805e..5b8645c 100644 --- a/src/Ratchet/Wamp/ServerProtocol.php +++ b/src/Ratchet/Wamp/ServerProtocol.php @@ -90,7 +90,7 @@ class ServerProtocol implements MessageComponentInterface, WsServerInterface { } if (!is_array($json) || $json !== array_values($json)) { - throw new \UnexpectedValueException("Invalid WAMP message format"); + throw new Exception("Invalid WAMP message format"); } switch ($json[0]) { @@ -134,7 +134,7 @@ class ServerProtocol implements MessageComponentInterface, WsServerInterface { break; default: - throw new Exception('Invalid message type'); + throw new Exception('Invalid WAMP message type'); } } diff --git a/src/Ratchet/Wamp/WampServer.php b/src/Ratchet/Wamp/WampServer.php index 7644fdc..b4cd88e 100644 --- a/src/Ratchet/Wamp/WampServer.php +++ b/src/Ratchet/Wamp/WampServer.php @@ -39,7 +39,7 @@ class WampServer implements MessageComponentInterface, WsServerInterface { public function onMessage(ConnectionInterface $conn, $msg) { try { $this->wampProtocol->onMessage($conn, $msg); - } catch (JsonException $je) { + } catch (Exception $je) { $conn->close(1007); } catch (\UnexpectedValueException $uve) { $conn->close(1007);