stevekane / promise-it-wont-hurt

A Workshopper module that teaches you to use promises in javascript
737 stars 219 forks source link

Fix error in excercise 9 "throw an error" #132

Closed AnneKlapwijk closed 7 years ago

AnneKlapwijk commented 7 years ago

What has been done

A very simple fix for https://github.com/stevekane/promise-it-wont-hurt/issues/126 and https://github.com/stevekane/promise-it-wont-hurt/issues/102

Instead of comparing the console logs of the error objects (which contain different file paths), compare the error messages.

Besides fixing the error, this would also make the exercise more consistent with exercise 3 "reject_a_promise" and 6 "shortcuts" which also console.log error.message instead of the entire error object.

How to test

parsePromised(process.argv[2]) .then(null, console.log)


- `promise-it-wont-hurt verify solution.js`
addaleax commented 7 years ago

This works, but do you think you could update this so that reject(e) remains and we use console.log(e.message) in the .then() handler instead? I think that would be even more consistent with the other tasks, plus it’s quite uncommon that the value passed to reject() is not an error object.

addaleax commented 7 years ago

Thanks. I’ve published promise-it-wont-hurt@1.1.0 – this was long overdue and contains quite a few updates. Let us know if you run into any trouble!

AnneKlapwijk commented 7 years ago

@addaleax Thanks! Will do.