Skip to content

Commit 2705844

Browse files
committed
refactor: Improve error reporting
1 parent 74b54c6 commit 2705844

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

generate-readme.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,18 @@ const config = {
6161
let md = '| Example | Runtime |\n';
6262
md += '|:--------------------------- |:-----|\n';
6363
examples.forEach((example) => {
64-
const data = JSON.parse(fs.readFileSync(example, 'utf8'));
65-
const dirname = path.dirname(example);
66-
const exampleUrl = `https://github.com/serverless/examples/tree/v3/${dirname}`;
67-
const runtime = getRuntime(dirname);
68-
const description = (data.description) ? `<br/> ${data.description}` : '';
69-
// add table rows
70-
md += `| [${formatPluginName(data.name)}](${exampleUrl}) ${description} | ${runtime} |\n`;
64+
try {
65+
const data = JSON.parse(fs.readFileSync(example, 'utf8'));
66+
const dirname = path.dirname(example);
67+
const exampleUrl = `https://github.com/serverless/examples/tree/v3/${dirname}`;
68+
const runtime = getRuntime(dirname);
69+
const description = (data.description) ? `<br/> ${data.description}` : '';
70+
// add table rows
71+
md += `| [${formatPluginName(data.name)}](${exampleUrl}) ${description} | ${runtime} |\n`;
72+
} catch (error) {
73+
error.message = `Error processign file: "${example}": ${error.message}`;
74+
throw error;
75+
}
7176
});
7277

7378
return md;

0 commit comments

Comments
 (0)