diff --git a/src/endpoints/document/v1/post.ts b/src/endpoints/document/v1/post.ts index d13fb80..439ee97 100644 --- a/src/endpoints/document/v1/post.ts +++ b/src/endpoints/document/v1/post.ts @@ -112,7 +112,14 @@ export default new Hono().post( name: setName, password: hashCombo }); - await fsWrite(ctx, { id: setId }); + + try { + await fsWrite(ctx, { id: setId }); + } catch (why) { + mutable.database.document.delete("id", setId); + + throw why; + } return ctx.json({ name: setName