mirror of
https://github.com/unarray/file-tree-generator.git
synced 2026-07-22 08:40:29 +00:00
Handle readdir errors
This commit is contained in:
parent
18ee5cea75
commit
73c77e1555
1 changed files with 17 additions and 1 deletions
|
|
@ -113,7 +113,23 @@ export class GenerateTree extends Modal {
|
|||
const selectedPath = dialogResponse.filePaths[0];
|
||||
const removePath = selectedPath.substring(0, selectedPath.lastIndexOf(sep) + sep.length);
|
||||
const regex = beginningString(removePath);
|
||||
const rowFiles = (await getFiles(selectedPath)).map(file => file.replace(regex, ""));
|
||||
let rowFiles: string[];
|
||||
|
||||
try {
|
||||
rowFiles = (await getFiles(selectedPath)).map(file => file.replace(regex, ""));
|
||||
} catch (error) {
|
||||
showNotice = false;
|
||||
notice.hide();
|
||||
|
||||
if (!(error instanceof Error)) {
|
||||
new Notice("❌ error while scanning directory");
|
||||
return;
|
||||
}
|
||||
|
||||
new Notice(`❌ error while scanning directory:\n${error.message}}`);
|
||||
return;
|
||||
}
|
||||
|
||||
let files: string[];
|
||||
|
||||
if (this.useIgnore) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue