[w3c/FileAPI] TypeMismatchError vs TypeError in the Entries API error callbacks (Issue #233)

jcayzac created an issue (w3c/FileAPI#233)

The File and Directory Entries API text folded in by #222 passes a `"TypeMismatchError"` `DOMException` to the `errorCallback` when a path argument denotes the wrong entry type or is invalid. Five sites: `FileSystemDirectoryEntry.getFile()` (type mismatch, invalid path), `FileSystemDirectoryEntry.getDirectory()` (type mismatch, invalid path), and `FileSystemFileEntry.file()`.

`TypeMismatchError` is a legacy error type that most specifications have replaced with `TypeError`. The question is whether this specification can make that switch compatibly.

This is currently an inline issue marker in the spec (`index.bs:1705`, carried over from the entries-api spec, which tracked it as an inline issue in its source).

WPT covers this error scenario:

- [entries-api/filesystemdirectoryentry-getFile.html](https://github.com/web-platform-tests/wpt/blob/master/entries-api/filesystemdirectoryentry-getFile.html) — automated, asserts `promise_rejects_dom(t, 'TypeMismatchError', …)` for both directory-mismatch and invalid-path rejections
- [entries-api/filesystemdirectoryentry-getDirectory.html](https://github.com/web-platform-tests/wpt/blob/master/entries-api/filesystemdirectoryentry-getDirectory.html) — automated, same pattern
- [entries-api/errors-manual.html](https://github.com/web-platform-tests/wpt/blob/master/entries-api/errors-manual.html) — manual, asserts `error.name === 'TypeMismatchError'`

Resolution path: check current wpt.fyi results for the automated tests across engines. If engines actually raise `TypeError` there (i.e. the `TypeMismatchError` assertions fail), updating the document to `TypeError` is safe. If engines still raise `TypeMismatchError`, the deprecated `DOMException` name must be kept — switching would change observable behavior of the shipped API.

Related:

- [WICG/entries-api#5: Behavior with mismatching absolute paths](https://github.com/WICG/entries-api/issues/5)
- [web-platform-tests/wpt#5613: Need tests for FileSystemEntry and friends](https://github.com/web-platform-tests/wpt/issues/5613)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/issues/233
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/FileAPI/issues/233@github.com>

Received on Friday, 20 November 2026 07:14:48 UTC