Skip to content

Commit

Permalink
feat: more informative user-facing errors regarding metadata verifica…
Browse files Browse the repository at this point in the history
…tion (#490)
  • Loading branch information
mediremi authored May 25, 2021
1 parent c7c4475 commit 47fb951
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 11 additions & 7 deletions server/src/routes/v1/apps/handlers/createApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 5 additions & 0 deletions server/src/routes/v1/apps/handlers/createAppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 47fb951

Please sign in to comment.