Skip to content

Commit

Permalink
fix(FileSystemAccessApiFsClient): stat method may throw TypeError on …
Browse files Browse the repository at this point in the history
…Safari
  • Loading branch information
alex-titarenko committed Feb 9, 2023
1 parent 285a8ef commit 9ee647e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/clients/fs/FileSystemAccessApiFsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,18 @@ export class FileSystemAccessApiFsClient implements FsClient {
return (await folder.getDirectoryHandle(name, { create: false })) as EntryHandle<T>
}
} catch (error: any) {
const { name } = error
switch (name) {
case ErrorNames.NotFoundError:
case ErrorNames.TypeMismatchError:
return undefined
default: throw error
if (error instanceof TypeError) {
return undefined
}
if (error instanceof DOMException) {
switch (error.name) {
case ErrorNames.NotFoundError:
case ErrorNames.TypeMismatchError:
return undefined
}
}

throw error
}
}
}
Expand Down

0 comments on commit 9ee647e

Please sign in to comment.