Note: This interface is obsolete per the latest specification. Use the new DOM4 DOMError interface instead.

In the File System API, a FileError represents error conditions that you might encounter while accessing the file system using the asynchronous API. It extends the FileError interface described in File Writer and adds several new error codes.

FileError objects are passed to error callbacks. The objects have a code that shows the type of error that occurred.

Best practices

Most people don't read the page on errors and exceptions unless they're stumped. So the following are a few tips that could help you avoid some pitfalls.

Error callbacks are not optional for your sanity

Although error callbacks are optional, you should include them in the arguments of the methods for the sake of the sanity of your users. A web app could fail for various reasons, so you don't want to spend the rest of your day guessing what's going on and going through maddening troubleshooting.

Don't run your app from file://

For security reasons, browsers do not allow you to run your app from file://. In fact, many of the powerful storage APIs (such as File System, BlobBuilder, and FileReader) throw errors if you run the app locally from file://. When you're just testing your app, and you don't want to set up a web server, you can bypass the security restriction on Chrome. Just start Chrome with the --allow-file-access-from-files flag. Use the flag only for testing purposes.

The file or directory cannot be read, typically due to permission problems that occur after a reference to a file has been acquired (for example, the file or directory is concurrently locked by another application).

Either there's not enough remaining storage space or the storage quota was reached and the user declined to give more space to the database. To ask for more storage, see Managing HTML5 Offline Storage.

Gecko notes

The FileError interface has been removed starting with Gecko 13 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10). Instead the more general DOMError interface is used and returned by FileReader.error.