aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

OLD - feat : reject promises with error like object #175

Closed npelletm closed 6 years ago

npelletm commented 6 years ago

It is a best practice to reject a promise with an Error object. Bluebird promise raise a warning in this case : http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-rejected-with-a-non-error because http-client promise use a HttpResponseMessage in rejection handler I add ErrorHttpResponseMessage inherits HttpResponseMessage and add name and message string attributes then bluebird considers this object as an error : https://github.com/petkaantonov/bluebird/blob/master/src/util.js#L240-L246 I also add rejectPromiseWithErrorObject: boolean; property default false to change the default behavior.

This PR include previous fix tests PR

EisenbergEffect commented 6 years ago

This PR looks the same as the previous. Could they have accidentally contained the same commits instead of being split on test fix vs. feature?

npelletm commented 6 years ago

Closed substituted with new PR #178