DX: Improved error message for publish:gitlab:merge-request action

Signed-off-by: Simone Fumagalli <simone.fumagalli@musement.com>
This commit is contained in:
Simone Fumagalli
2023-05-17 15:27:28 +02:00
parent 2d98053d52
commit b269da39ac
2 changed files with 9 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': minor
---
Clearer error messages for action publish:gitlab:merge-request
@@ -218,14 +218,16 @@ export const createPublishGitlabMergeRequestAction = (options: {
try {
await api.Branches.create(repoID, branchName, String(defaultBranch));
} catch (e) {
throw new InputError(`The branch creation failed ${e}`);
throw new InputError(
`The branch creation failed. Please check that your repo does not already contain a branch named '${branchName}'. ${e}`,
);
}
try {
await api.Commits.create(repoID, branchName, ctx.input.title, actions);
} catch (e) {
throw new InputError(
`Committing the changes to ${branchName} failed ${e}`,
`Committing the changes to ${branchName} failed. Please check that none of the files created by the template already exists. ${e}`,
);
}