Name

FileError — error while reading a file

Synopsis

A FileError object represents an error that occurred when reading a file with FileReader or FileReaderSync. If the synchronous API is used, the FileError object is thrown. If the asynchronous API is used, the FileError object is the value of the error property of the FileReader object when the error event is dispatched.

Note that the FileWriter API (which is described in The Filesystem API, but is not stable enough to document in this reference section) adds new error code constants to this object.

Constants

The FileError error codes are the following:

unsigned short NOT_FOUND_ERR = 1

The file does not exist. (Perhaps it was deleted after the user selected it, but before your program attempted to read it.)

unsigned short SECURITY_ERR = 2

Unspecified security issues prevent the browser from allowing your code to read the file.

unsigned short ABORT_ERR = 3

The attempt to read the file was aborted.

unsigned short NOT_READABLE_ERR = 4

The file is not readable, perhaps because its permissions have changed or because another process has locked it.

unsigned short ENCODING_ERR = 5

A call to readAsDataURL() failed because the file was too long to encode in a data:// URL.

Properties

readonly unsigned short code

This property specifies what kind of error occurred. Its value is one of the constants above.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.