storage icon indicating copy to clipboard operation
storage copied to clipboard

Document that `chrome.runtime.lastError` causes a rejection

Open piedrahitapablo opened this issue 4 years ago • 1 comments

Documentation Is:

  • [x] Missing
  • [ ] Needed
  • [ ] Confusing
  • [ ] Not Sure?

Please Explain in Detail...

If there is an error when executing the callbacks passed to the chrome API, chrome.runtime.lastError will be set. On the docs for this package or the source code I have not been able to find a reference to that situation. Also, as this uses promises, the check on the promise's then will not work since the lastError is only set inside the callback.

Your Proposal for Changes

Include a text explaining if this is needed or it's handled internally by you and the promise is rejected when lastError is set.

piedrahitapablo avatar Sep 08 '20 14:09 piedrahitapablo

@piedrahitapablo Good observation. This library uses chrome-promise, which rejects if lastError is set.

This would be a great documentation PR. 😉

jacksteamdev avatar Sep 09 '20 01:09 jacksteamdev