Skip to content

Commit 116302a

Browse files
committed
Throw UnexpectedTokenException for namespace format errors, too
This way, we can try to recover in lenient mode
1 parent 71cb230 commit 116302a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Sabberworm/CSS/Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ private function parseAtRule() {
161161
}
162162
$this->consume(';');
163163
if ($sPrefix !== null && !is_string($sPrefix)) {
164-
throw new \Exception('Wrong namespace prefix '.$sPrefix);
164+
throw new UnexpectedTokenException('Wrong namespace prefix', $sPrefix, 'custom');
165165
}
166166
if (!($mUrl instanceof CSSString || $mUrl instanceof URL)) {
167-
throw new \Exception('Wrong namespace url of invalid type '.$mUrl);
167+
throw new UnexpectedTokenException('Wrong namespace url of invalid type', $mUrl, 'custom');
168168
}
169169
return new CSSNamespace($mUrl, $sPrefix);
170170
} else {

0 commit comments

Comments
 (0)