Skip to content

Commit a7169b3

Browse files
UlrichEckhardtitsgoingd
authored andcommitted
Event: Invoke end() even in case of exceptions.
If the closure throws an exception, the end() call was skipped otherwise.
1 parent a790200 commit a7169b3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Clockwork/Request/Timeline/Event.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ public function end()
5050
public function run(\Closure $closure)
5151
{
5252
$this->begin();
53-
54-
$result = $closure();
55-
56-
$this->end();
57-
58-
return $result;
53+
try {
54+
return $closure();
55+
} finally {
56+
$this->end();
57+
}
5958
}
6059

6160
// Set or retrieve event duration (in ms), event can be defined with both start and end time or just a single time and duration

0 commit comments

Comments
 (0)