Re: [push-api] .getRegistration() should not reject if there is no registration (but return a null object) (#96)

http://www.w3.org/2001/tag/doc/promises-guide#rejections-should-be-exceptional

> What exactly you consider "exceptional" is up for debate, as always. But, you should always ask, before rejecting a promise: if this function was synchronous, would I expect a thrown exception under this circumstance? Or perhaps a failure value (like null, false, or undefined)?
> …
> Bad uses of rejections include:
>
> When a value is asked for asynchronously and is not found: for example asyncMap.get("key") should return a promise for undefined when there is no entry for "key"

There's a big discussion over at https://github.com/slightlyoff/ServiceWorker/issues/374 where I fought for `caches.match` to reject if no match was found. I was talked around in the end.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/push-api/issues/96#issuecomment-67006837

Received on Monday, 15 December 2014 15:07:22 UTC