MSEdgeExplainers icon indicating copy to clipboard operation
MSEdgeExplainers copied to clipboard

[Ratings & Reviews Prompt] Promise rejection reasons must be exceptions, and used for exceptional situations

Open domenic opened this issue 4 years ago • 1 comments

The current explainer rejects the promise in several non-exceptional situations. You can tell, because instead of using Error objects for those cases, it instead using strings.

This is contrary to how promises generally work on the web platform. See:

  • https://www.w3.org/2001/tag/doc/promises-guide#rejections-should-be-exceptional
  • https://www.w3.org/2001/tag/doc/promises-guide#reasons-should-be-errors

Instead the API should fulfill in non-exceptional cases, including completed/deferred/disallowed, and only reject in the error case. Perhaps it could fulfill with something like { status: "completed" } or { status: "handed-off", catalog: "https://play.google.com/" }

domenic avatar Dec 03 '20 14:12 domenic

Thanks for that feedback @domenic. This is the first Promise-based API I’ve developed for the platform, so I appreciate the guidance.

aarongustafson avatar Dec 03 '20 17:12 aarongustafson