Merge pull request #695 from chaptergy/failed-certificate-autoremove

Adds autoremove of failed certificate creations in DB
This commit is contained in:
jc21 2020-11-09 10:10:00 +10:00 committed by GitHub
commit 540554c4f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -216,6 +216,13 @@ const internalCertificate = {
return saved_row; 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 { } else {
return certificate; return certificate;