Skip to content

Commit

Permalink
Merge pull request #42 from clue-labs/unhandled-rejections
Browse files Browse the repository at this point in the history
Update close handler to avoid unhandled promise rejections
  • Loading branch information
SimonFrings committed Jul 10, 2023
2 parents c275806 + df050ae commit c11d91a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -14,7 +14,8 @@
"php": ">=5.4",
"evenement/evenement": "^3.0 || ^2.0",
"react/event-loop": "^1.2",
"react/http": "^1.6"
"react/http": "^1.6",
"react/promise": "^3 || ^2.10 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.35"
Expand Down
2 changes: 2 additions & 0 deletions src/EventSource.php
Expand Up @@ -270,6 +270,8 @@ public function close()

$request->then(function (ResponseInterface $response) {
$response->getBody()->close();
}, function () {
// ignore to avoid reporting unhandled rejection
});
$request->cancel();
}
Expand Down

0 comments on commit c11d91a

Please sign in to comment.