From 0d0f399cc22a0e67ec1514328ebdacb9979e845b Mon Sep 17 00:00:00 2001 From: Andy Burke Date: Mon, 30 Jun 2025 22:26:25 -0700 Subject: [PATCH] fix: don't blow up if a collection's root goes missing --- deno.json | 2 +- fsdb.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/deno.json b/deno.json index 3533911..2edb6f1 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@andyburke/fsdb", - "version": "0.6.0", + "version": "0.6.1", "license": "MIT", "exports": { ".": "./fsdb.ts", diff --git a/fsdb.ts b/fsdb.ts index 5377926..2513bef 100644 --- a/fsdb.ts +++ b/fsdb.ts @@ -224,6 +224,14 @@ export class FSDB_COLLECTION> { 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,