w3c / geofencing-api

13 stars 9 forks source link

getbyID() method: Resolving promise with null when ID not found (from Josh Soref) #20

Closed gmandyam closed 9 years ago

gmandyam commented 9 years ago

Sec. 6.2

If promise was not resolved, resolve promise with null.

why not reject with notfound?

mkruisselbrink commented 9 years ago

Because rejecting a promise should be done where a non-promise using API would throw an exception. Not finding a geofence is not such a situation (similarly getElementByID, navigator.serviceWorker.getRegistration("..."), etc all also return/resolve with null when not found).