Skip to content

Commit 1518ecd

Browse files
committed
Adds autoremove of failed certificate creations in DB
1 parent 5bc3e47 commit 1518ecd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

backend/internal/certificate.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ const internalCertificate = {
216216
return saved_row;
217217
});
218218
});
219+
}).catch(async (error) => {
220+
// Delete the certificate from the database if it was not created successfully
221+
await certificateModel
222+
.query()
223+
.deleteById(certificate.id);
224+
225+
throw error;
219226
});
220227
} else {
221228
return certificate;

0 commit comments

Comments
 (0)