W3C home > Mailing lists > Public > public-geolocation@w3.org > October 2008

Re: synchronous error handling.

From: Aaron Boodman <aa@google.com>
Date: Wed, 29 Oct 2008 10:01:52 -0700
Message-ID: <278fd46c0810291001q4c3326d3idd2f8b8a7c9946c9@mail.gmail.com>
To: "Greg Bolsinga" <bolsinga@apple.com>
Cc: public-geolocation@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 22 March 2012 18:13:40 GMT