Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Collector/ProfileClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ public function sendAsyncRequest(RequestInterface $request)

$onFulfilled = function (ResponseInterface $response) use ($event, $stack) {
$this->collectResponseInformations($response, $event, $stack);
$event->stop();

return $response;
};

$onRejected = function (\Exception $exception) use ($event, $stack) {
$this->collectExceptionInformations($exception, $event, $stack);
$event->stop();

throw $exception;
};
Expand All @@ -100,8 +102,11 @@ public function sendAsyncRequest(RequestInterface $request)

try {
return $this->client->sendAsyncRequest($request)->then($onFulfilled, $onRejected);
} finally {
} catch (\Exception $e) {
$event->stop();

throw $e;
} finally {
if ($activateStack) {
//We only activate the stack when created by the StackPlugin.
$this->collector->activateStack($stack);
Expand Down