Skip to content

Commit 6ef11c5

Browse files
Raise exception with useful message
1 parent 5bd7eb8 commit 6ef11c5

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Driver/Driver.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ public function collectsBranchAndPathCoverage(): bool
7676
public function enableBranchAndPathCoverage(): void
7777
{
7878
if (!$this->canCollectBranchAndPathCoverage()) {
79-
throw new BranchAndPathCoverageNotSupportedException;
79+
throw new BranchAndPathCoverageNotSupportedException(
80+
\sprintf(
81+
'The %s driver does not support branch and path coverage',
82+
$this->name()
83+
)
84+
);
8085
}
8186

8287
$this->collectBranchAndPathCoverage = true;
@@ -103,7 +108,12 @@ public function detectsDeadCode(): bool
103108
public function enableDeadCodeDetection(): void
104109
{
105110
if (!$this->canDetectDeadCode()) {
106-
throw new DeadCodeDetectionNotSupportedException;
111+
throw new DeadCodeDetectionNotSupportedException(
112+
\sprintf(
113+
'The %s driver does not support dead code detection',
114+
$this->name()
115+
)
116+
);
107117
}
108118

109119
$this->detectDeadCode = true;

0 commit comments

Comments
 (0)