Skip to content

Commit 827cf2a

Browse files
authored
fix(core): improve iOS enumEntities error context
Agent-Logs-Url: https://github.com/NativeScript/NativeScript/sessions/ab3bdef9-f76e-4cf6-aaf2-2a6c19ea0f7e
1 parent d62974f commit 827cf2a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/core/file-system/file-system-access.ios.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,18 @@ export class FileSystemAccess {
629629
private enumEntities(path: string, callback: (entity: { path: string; name: string; extension: string }) => boolean, onError?: (error) => any) {
630630
try {
631631
const fileManager = NSFileManager.defaultManager;
632+
if (!this.folderExists(path)) {
633+
if (onError) {
634+
onError(new Error("Failed to enum files for folder '" + path + "': no folder exists at path"));
635+
}
636+
637+
return;
638+
}
639+
632640
const enumerator = fileManager.enumeratorAtPath(path);
633641
if (!enumerator) {
634642
if (onError) {
635-
onError(new Error("Failed to enum files for folder '" + path + "'"));
643+
onError(new Error("Failed to enum files for folder '" + path + "': unable to create directory enumerator"));
636644
}
637645

638646
return;

0 commit comments

Comments
 (0)