Re: synchronous error handling.

On Wed, Oct 29, 2008 at 9:49 AM, Greg Bolsinga <bolsinga@apple.com> wrote:
>
> FWIW, In the implementation in
> https://bugs.webkit.org/attachment.cgi?id=24627&action=prettypatch
>
> I implemented it call the error callback before returning from
> getCurrentPosition and watchPosition. If the caller doesn't supply an
> errorCallback, the method will return and the caller will not know of this
> error. Perhaps there can be some kind of an exception thrown?
>
> Any clarity here would be appreciated.

These kinds of details are frequently underspecified and each browser
has it's own conventions unfortunately. I think it's frustrating as a
developer when a callback can sometimes get called synchronously or
sometimes asynchronously. In Gears, we have the convention that
callbacks are always either one or the other.

I also feel that error callbacks shouldn't be used when there is a
syntax, calling convention, or other fatal developer time error. In
these cases, the code is completely wrong so we should just throw on
the call to getCurrentPosition() or watchPosition(). Examples of this
would be missing arguments, type mismatches, etc.

- a

Received on Wednesday, 29 October 2008 17:02:31 UTC