[w3c/clipboard-apis] Clarify promise rejection value (#76)

I'm a bit unsure of what to expect back from the async clipboard API when there is a failure. The [`explainer.adoc`](https://github.com/w3c/clipboard-apis/blob/master/explainer.adoc) here doesn't use the rejection value at all, and the spec simply says "reject |p|".

https://github.com/w3c/clipboard-apis/blob/2ac3c0b5894558a4b468be6f09feb588efff4077/index.bs#L676

Is the intention that the Promise should simply reject with the value `undefined` instead of an `Error` instance?

This is how we have interpreted it here: feross/clipboard-copy#24

I feel that this goes against best practices, and I think there is a ton of code in the wild that does something similar to:

```js
runAllMythings().catch((err) => {
  console.log(err.stack)
})
```

Wouldn't it be nice to reject with an error, maybe `reject(new Error('Persmission for writing to clipboard was not granted'))`?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/76

Received on Tuesday, 3 April 2018 11:34:44 UTC