diff --git a/.changeset/calm-windows-drum.md b/.changeset/calm-windows-drum.md new file mode 100644 index 0000000..852993a --- /dev/null +++ b/.changeset/calm-windows-drum.md @@ -0,0 +1,5 @@ +--- +'@emigrate/plugin-storage-fs': patch +--- + +Throw a more descriptive error when a file lock couldn't be acquired diff --git a/packages/plugin-storage-fs/src/index.ts b/packages/plugin-storage-fs/src/index.ts index f030fa8..4b5b474 100644 --- a/packages/plugin-storage-fs/src/index.ts +++ b/packages/plugin-storage-fs/src/index.ts @@ -55,11 +55,15 @@ export default function storageFs({ filename }: StorageFsOptions): StoragePlugin async initializeStorage() { return { async lock(migrations) { - const fd = await fs.open(lockFilePath, 'wx'); + try { + const fd = await fs.open(lockFilePath, 'wx'); - await fd.close(); + await fd.close(); - return migrations; + return migrations; + } catch { + throw new Error('Could not acquire file lock for migrations'); + } }, async unlock() { try {