Skip to content

Commit ce7feab

Browse files
dont let one failure stop prep-samples
1 parent e28d507 commit ce7feab

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

scripts/prep-samples.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ directories.forEach((sample) => {
3434
// Languages:
3535
//
3636
// We want to extract the title, short description, tags, and languages from the readme. Tags and languages are comma separated lists.
37-
const title = readme.match(/Title: (.*)/)[1];
38-
const shortDescription = readme.match(/Short Description: (.*)/)[1];
39-
const tags = readme.match(/Tags: (.*)/)[1].split(',').map(tag => tag.trim());
40-
const languages = readme.match(/Languages: (.*)/)[1].split(',').map(language => language.trim());
37+
let title, shortDescription, tags, languages;
38+
try {
39+
title = readme.match(/Title: (.*)/)[1];
40+
shortDescription = readme.match(/Short Description: (.*)/)[1];
41+
tags = readme.match(/Tags: (.*)/)[1].split(',').map(tag => tag.trim());
42+
languages = readme.match(/Languages: (.*)/)[1].split(',').map(language => language.trim());
43+
} catch (error) {
44+
console.log(`@@ Failed to parse readme for sample ${sample}`, error);
45+
return;
46+
}
4147

4248
let configs = new Set();
4349
try {

0 commit comments

Comments
 (0)