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
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@andyburke/fsdb",
|
"name": "@andyburke/fsdb",
|
||||||
"version": "0.6.0",
|
"version": "0.6.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./fsdb.ts",
|
".": "./fsdb.ts",
|
||||||
|
|
8
fsdb.ts
8
fsdb.ts
|
@ -224,6 +224,14 @@ export class FSDB_COLLECTION<T extends Record<string, any>> {
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
|
|
||||||
// TODO: better way to get a pattern to match files in this collection?
|
// 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 (
|
for await (
|
||||||
const entry of fs.walk(this.config.root, {
|
const entry of fs.walk(this.config.root, {
|
||||||
includeDirs: false,
|
includeDirs: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue