fix: don't blow up if a collection's root goes missing
This commit is contained in:
parent
73d4f636cc
commit
0d0f399cc2
2 changed files with 9 additions and 1 deletions
8
fsdb.ts
8
fsdb.ts
|
@ -224,6 +224,14 @@ export class FSDB_COLLECTION<T extends Record<string, any>> {
|
|||
let counter = 0;
|
||||
|
||||
// TODO: better way to get a pattern to match files in this collection?
|
||||
const root_stat = await Deno.lstat(this.config.root);
|
||||
|
||||
if (!root_stat.isDirectory) {
|
||||
console.warn(`missing root directory for fsdb collection:`);
|
||||
console.dir(this.config);
|
||||
return results;
|
||||
}
|
||||
|
||||
for await (
|
||||
const entry of fs.walk(this.config.root, {
|
||||
includeDirs: false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue