Skip to content

Commit 576855a

Browse files
committed
fix(sltt-app): catch some possible errors storing docs
1 parent 444487b commit 576855a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

storage/docs.ts

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ export const handleStoreDoc = async (docsFolder: string, { project, doc, remoteS
9292
}
9393
const fullFromPath = buildDocFolder(docsFolder, project, !!remoteSeq)
9494
const { _id, modDate, creator, modBy } = doc as { _id: string, modDate: string, creator: string, modBy: string }
95+
if (!_id || !modDate) {
96+
throw Error(`_id and modDate properties are required in doc: ${JSON.stringify(doc)}`)
97+
}
98+
if (!remoteSeq && !modBy) {
99+
throw Error(`modBy property is required in local doc: ${JSON.stringify(doc)}`)
100+
}
95101
const filename = composeFilename(modDate, _id, creator, modBy, remoteSeq)
96102
if (filename.length > 255) {
97103
throw Error(`attempted filename is too long: ${filename}`)

0 commit comments

Comments
 (0)