Skip to content

Commit b9cf531

Browse files
authoredAug 15, 2023
feat(core): throw on errors (#898)
1 parent c4c9f1c commit b9cf531

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎packages/orval/src/generate.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export const generateSpecs = async (
6161
await generateSpec(workspace, options, projectName);
6262
} catch (e) {
6363
log(chalk.red(`🛑 ${projectName ? `${projectName} - ` : ''}${e}`));
64+
process.exit(1)
6465
}
6566
} else {
6667
errorMessage('Project not found');
@@ -69,18 +70,23 @@ export const generateSpecs = async (
6970
return;
7071
}
7172

72-
return asyncReduce(
73+
let hasErrors: true | undefined
74+
const accumulate = asyncReduce(
7375
Object.entries(config),
7476
async (acc, [projectName, options]) => {
7577
try {
7678
acc.push(await generateSpec(workspace, options, projectName));
7779
} catch (e) {
80+
hasErrors = true
7881
log(chalk.red(`🛑 ${projectName ? `${projectName} - ` : ''}${e}`));
7982
}
8083
return acc;
8184
},
8285
[] as void[],
8386
);
87+
88+
if (hasErrors) process.exit(1)
89+
return accumulate
8490
};
8591

8692
export const generateConfig = async (

1 commit comments

Comments
 (1)

vercel[bot] commented on Aug 15, 2023

@vercel[bot]
Please sign in to comment.