fix: add extra args support for exception to bun scripts

This commit is contained in:
Ruben Fiszel
2024-10-17 01:19:25 +02:00
parent fac41fd700
commit f3ddd76159
@@ -1105,6 +1105,16 @@ try {{
if (step_id) {{
err["step_id"] = step_id;
}}
const extra = {{}};
Object.getOwnPropertyNames(e).forEach((key) => {{
if (['line', 'name', 'stack', 'column', 'message', 'sourceURL', 'originalLine', 'originalColumn'].includes(key)) {{
return;
}}
extra[key] = e[key];
}});
if (Object.keys(extra).length > 0) {{
err["extra"] = extra;
}}
await fs.writeFile("result.json", JSON.stringify(err));
process.exit(1);
}}