Skip to content

Commit 492c1e7

Browse files
Timothy Lindvalltimlindvall
Timothy Lindvall
authored andcommitted
fix: Remove unnecessary try/catch.
1 parent bec10d2 commit 492c1e7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/@css-blocks/core/src/PrecompiledDefinitions/compiled-comments.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ export const REGEXP_COMMENT_FOOTER = /\/\*#css-blocks end*\\/m;
3232
*/
3333
export function isDefinitionUrlValid(urlOrPath: string): boolean {
3434
// Try to parse as a URL first.
35-
try {
36-
const parsedUrl = url.parse(urlOrPath);
37-
if (parsedUrl.protocol) {
38-
return parsedUrl.protocol === 'data:';
39-
}
40-
} catch (e) {}
35+
const parsedUrl = url.parse(urlOrPath);
36+
if (parsedUrl.protocol) {
37+
return parsedUrl.protocol === 'data:';
38+
}
4139

4240
// If we can't parse as a URL with a protocol, it's a path.
4341
return !path.isAbsolute(urlOrPath);

0 commit comments

Comments
 (0)