aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2016-06-17 09:22:15 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2016-06-17 17:04:44 +0200
commitc5821c112185dd8f7a4bfe257a287a2a93e40883 (patch)
treea297086bed7767b66b22219a4bf5d503e8cf66a4
parent7710d978cc4bb4793dfb272aac92e0d977984936 (diff)
downloadWebsocket-c5821c112185dd8f7a4bfe257a287a2a93e40883.zip
Websocket-c5821c112185dd8f7a4bfe257a287a2a93e40883.tar.gz
Websocket-c5821c112185dd8f7a4bfe257a287a2a93e40883.tar.bz2
Connection: Wrap listeners into a try/catch block.
Same reasons than other listeners.
-rw-r--r--Connection.php42
1 files changed, 30 insertions, 12 deletions
diff --git a/Connection.php b/Connection.php
index 5337bae..ab9b7b0 100644
--- a/Connection.php
+++ b/Connection.php
@@ -344,12 +344,21 @@ abstract class Connection
$node->clearFragmentation();
if (true === $isBinary) {
- $this->getListener()->fire(
- 'binary-message',
- new Event\Bucket([
- 'message' => $message
- ])
- );
+ try {
+ $this->getListener()->fire(
+ 'binary-message',
+ new Event\Bucket([
+ 'message' => $message
+ ])
+ );
+ } catch (\Exception $e) {
+ $this->getListener()->fire(
+ 'error',
+ new Event\Bucket([
+ 'exception' => $e
+ ])
+ );
+ }
break;
}
@@ -360,12 +369,21 @@ abstract class Connection
break;
}
- $this->getListener()->fire(
- 'message',
- new Event\Bucket([
- 'message' => $message
- ])
- );
+ try {
+ $this->getListener()->fire(
+ 'message',
+ new Event\Bucket([
+ 'message' => $message
+ ])
+ );
+ } catch (\Exception $e) {
+ $this->getListener()->fire(
+ 'error',
+ new Event\Bucket([
+ 'exception' => $e
+ ])
+ );
+ }
} else {
$node->setComplete(false);
}