Skip to content

Commit

Permalink
DOP-4490-b change how errors are thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Apr 10, 2024
1 parent 220aa00 commit d50093d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/services/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ export class SlackConnector implements ISlackConnector {
// if deploy all was selected:
if (stateValues['block_deploy_option']['deploy_option']?.selected_option?.value == 'deploy_all') {
if (!isAdmin) {
throw {
statusCode: 401,
headers: { 'Content-Type': 'application/json' },
};
throw new Error('User is not an admin and therefore not entitled to deploy all repos');
}

values['deploy_option'] = 'deploy_all';
Expand All @@ -92,10 +89,7 @@ export class SlackConnector implements ISlackConnector {
}
//return an error if radio button choice 'deploy individual repos' was selected but no repo was actually chosen
else if (blockInputKey == 'repo_option') {
throw {
statusCode: 400,
headers: { 'Content-Type': 'application/json' },
};
throw new Error('Deploy individual repos was selected but no repo was actually chosen to be deployed');
}
// input value
else if (stateValuesObj?.value) {
Expand Down

0 comments on commit d50093d

Please sign in to comment.