Adds autoremove of failed certificate creations in DB

This commit is contained in:
chaptergy 2020-11-06 12:29:38 +01:00
parent 5bc3e474a9
commit 1518ecd1e9

View File

@ -216,6 +216,13 @@ const internalCertificate = {
return saved_row;
});
});
}).catch(async (error) => {
// Delete the certificate from the database if it was not created successfully
await certificateModel
.query()
.deleteById(certificate.id);
throw error;
});
} else {
return certificate;