File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,8 @@ function suggestSpecs(bad: URL): void {
7777 }
7878}
7979
80- let checked = 0 ;
80+ let checkedFeatures = 0 ;
81+ let checkedSpecs = 0 ;
8182let errors = 0 ;
8283
8384// Ensure every exception in defaultAllowlist is needed
@@ -92,19 +93,26 @@ for (const [allowedUrl, message] of defaultAllowlist) {
9293for ( const [ id , data ] of Object . entries ( features ) ) {
9394 const specs = Array . isArray ( data . spec ) ? data . spec : [ data . spec ] ;
9495 for ( const spec of specs ) {
95- const url = new URL ( spec ) ;
96- if ( ! isOK ( url ) ) {
96+ let url : URL ;
97+ try {
98+ url = new URL ( spec ) ;
99+ } catch ( error ) {
100+ console . error ( `Invalid URL "${ spec } " found in spec for "${ data . name } "` ) ;
101+ errors ++ ;
102+ }
103+ if ( url && ! isOK ( url ) ) {
97104 console . error ( `URL for ${ id } not in web-specs: ${ url . toString ( ) } ` ) ;
98105 suggestSpecs ( url ) ;
99106 errors ++ ;
100107 }
101- checked ++ ;
108+ checkedSpecs ++ ;
102109 }
110+ checkedFeatures ++ ;
103111}
104112
105113if ( errors ) {
106- console . log ( `\n ${ checked } features checked , found ${ errors } error(s)` ) ;
114+ console . log ( `\nChecked ${ checkedSpecs } specs in ${ checkedFeatures } features , found ${ errors } error(s)` ) ;
107115 process . exit ( 1 ) ;
108116} else {
109- console . log ( `${ checked } features checked , no errors` ) ;
117+ console . log ( `\nChecked ${ checkedSpecs } specs in ${ checkedFeatures } features , no errors` ) ;
110118}
You can’t perform that action at this time.
0 commit comments