Skip to content

Commit a392211

Browse files
committed
Properly throw UnexpectedValueException for unconnected graphs
1 parent 0bcd6d5 commit a392211

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/MinimumSpanningTree/Prim.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ public function getEdges()
5656
$cheapestEdge = $edgeQueue->extract();
5757
/* @var $cheapestEdge EdgeDirected */
5858
} catch (Exception $e) {
59-
return $returnEdges;
60-
throw new UnexpectedValueException('Graph has more than one component');
59+
throw new UnexpectedValueException('Graph has more than one component', 0, $e);
6160
}
6261

6362
// Check if edge is between unmarked and marked edge

0 commit comments

Comments
 (0)