MSEdgeExplainers
MSEdgeExplainers copied to clipboard
[Ratings & Reviews Prompt] Promise rejection reasons must be exceptions, and used for exceptional situations
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/" }
Thanks for that feedback @domenic. This is the first Promise-based API I’ve developed for the platform, so I appreciate the guidance.