RE: [FileAPI] Result of calling MultipleReads on FileReader

On Monday, April 11, 2011 8:28 AM, Arun Ranganathan wrote:
> On 3/31/11 6:12 PM, Eric Uhrhane wrote:
> > I think it's cleaner and simpler just to throw.  FileReader and XHR
> > are already different enough that a bit more, as long as it's a
> > usability improvement, isn't a big deal.  The efficiency improvement
> > is just a bonus.
> 
> Eric: are you sure you mean "throw" or do you mean, fire error event or
> abort?  Note that only FileReaderSync (running on threads) actually
> "throws" in terms of an exception.

I think throwing an exception would be appropriate here. The FileReader
will know synchronously that it is already doing a read and that calling
read again is an invalid operation. Firing the error event should be
reserved for errors that come from the operation of the reader and not
because the developer called it incorrectly.

Cheers,

Adrian.

Received on Monday, 11 April 2011 16:06:23 UTC