diff --git a/server/src/routes/v1/apps/handlers/createApp.js b/server/src/routes/v1/apps/handlers/createApp.js index 30c9ef414..e0e0f8b9b 100644 --- a/server/src/routes/v1/apps/handlers/createApp.js +++ b/server/src/routes/v1/apps/handlers/createApp.js @@ -132,13 +132,17 @@ module.exports = { ) const { file } = payload - verifyBundle({ - buffer: file._data, - appId: app.id, - appName: name, - version, - organisationName: organisation.name, - }) + try { + verifyBundle({ + buffer: file._data, + appId: app.id, + appName: name, + version, + organisationName: organisation.name, + }) + } catch (error) { + throw Boom.badRequest(error) + } const appUpload = saveFile( `${app.id}/${appVersion.id}`, 'app.zip', diff --git a/server/src/routes/v1/apps/handlers/createAppVersion.js b/server/src/routes/v1/apps/handlers/createAppVersion.js index cc0cd4c44..45e5433b8 100644 --- a/server/src/routes/v1/apps/handlers/createAppVersion.js +++ b/server/src/routes/v1/apps/handlers/createAppVersion.js @@ -196,7 +196,12 @@ module.exports = { version, organisationName: organisation.name, }) + } catch (err) { + await transaction.rollback() + throw Boom.badRequest(err) + } + try { await saveFile(`${appId}/${versionId}`, 'app.zip', file._data) } catch (err) { await transaction.rollback()