This commit is contained in:
1 parent
0cef0dd3a1
commit
f2e400c89e
6 files changed
+140
-31
No files matched your search
@@ -349,21 +349,26 @@ class FolderMonitor extends EventEmitter {
|
||||
const settings = this._settings;
|
||||
try {
|
||||
await this._access(settings.folderPath);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
|
||||
return this._result([], false, false, trigger);
|
||||
return this._result([], false, false, trigger, { errorCode: this._scanErrorCode(error) });
|
||||
}
|
||||
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
|
||||
try {
|
||||
const files = await this._discoverFiles(settings, generation);
|
||||
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
|
||||
return this._result(files, true, this._reachable === false, trigger);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
if (!this._isCurrent(generation)) return this._cancelledResult(trigger);
|
||||
return this._result([], true, false, trigger, { error: 'Ordnerscan fehlgeschlagen' });
|
||||
return this._result([], true, false, trigger, { error: 'Ordnerscan fehlgeschlagen', errorCode: this._scanErrorCode(error) });
|
||||
}
|
||||
}
|
||||
|
||||
_scanErrorCode(error) {
|
||||
const code = String(error?.code || '');
|
||||
return ['ENOENT', 'ENOTDIR', 'EACCES', 'EPERM', 'EBUSY', 'EIO', 'EMFILE', 'ENFILE'].includes(code) ? code : '';
|
||||
}
|
||||
|
||||
async _discoverFiles(settings, generation) {
|
||||
const discovered = await this._walkFolder(settings.folderPath, { recursive: !!settings.recursive });
|
||||
if (!this._isCurrent(generation)) return [];
|
||||
|
||||
Reference in new issue
Block a user