fix revert on unpublished app
This commit is contained in:
parent
56e5aca60f
commit
ed051e1547
|
@ -82,6 +82,13 @@ exports.revert = async ctx => {
|
||||||
const db = new CouchDB(productionAppId, { skip_setup: true })
|
const db = new CouchDB(productionAppId, { skip_setup: true })
|
||||||
const info = await db.info()
|
const info = await db.info()
|
||||||
if (info.error) throw info.error
|
if (info.error) throw info.error
|
||||||
|
const deploymentDoc = await db.get(DocumentTypes.DEPLOYMENTS)
|
||||||
|
if (
|
||||||
|
!deploymentDoc.history ||
|
||||||
|
Object.keys(deploymentDoc.history).length === 0
|
||||||
|
) {
|
||||||
|
throw new Error("No deployments for app")
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return ctx.throw(400, "App has not yet been deployed")
|
return ctx.throw(400, "App has not yet been deployed")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue