screwdriver-api 8.0.37 → 8.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "8.0.37",
3
+ "version": "8.0.38",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -153,7 +153,11 @@ module.exports = () => ({
153
153
 
154
154
  // Update admins
155
155
  if (!prNum) {
156
- await updateAdmins({ permissions, pipeline, user });
156
+ try {
157
+ await updateAdmins({ permissions, pipeline, user });
158
+ } catch (err) {
159
+ throw boom.boomify(err, { statusCode: err.statusCode });
160
+ }
157
161
  }
158
162
 
159
163
  // Get scmConfig
@@ -171,16 +175,21 @@ module.exports = () => ({
171
175
  payload.prNum = String(prNum);
172
176
  payload.type = 'pr';
173
177
 
174
- const [files, prInfo] = await Promise.all([
175
- scm.getChangedFiles({
176
- webhookConfig: null,
177
- type: 'pr',
178
- ...scmConfig
179
- }),
180
- scm.getPrInfo(scmConfig)
181
- ]).catch(err => {
178
+ let files;
179
+ let prInfo;
180
+
181
+ try {
182
+ [files, prInfo] = await Promise.all([
183
+ scm.getChangedFiles({
184
+ webhookConfig: null,
185
+ type: 'pr',
186
+ ...scmConfig
187
+ }),
188
+ scm.getPrInfo(scmConfig)
189
+ ]);
190
+ } catch (err) {
182
191
  throw boom.boomify(err, { statusCode: err.statusCode });
183
- });
192
+ }
184
193
 
185
194
  if (files && files.length) {
186
195
  payload.changedFiles = files;
@@ -196,14 +205,17 @@ module.exports = () => ({
196
205
  restrictPR = pipeline.annotations[ANNOT_RESTRICT_PR];
197
206
  }
198
207
 
199
- // PR author should be able to rerun their own PR build if restrictPR is not on
200
208
  if (restrictPR !== 'none' || prInfo.username !== username) {
201
209
  // Remove user from admins
202
- await updateAdmins({
203
- permissions,
204
- pipeline,
205
- user
206
- });
210
+ try {
211
+ await updateAdmins({
212
+ permissions,
213
+ pipeline,
214
+ user
215
+ });
216
+ } catch (err) {
217
+ throw boom.boomify(err, { statusCode: err.statusCode });
218
+ }
207
219
  }
208
220
  }
209
221