Reject the deferred in the event of an error.
Merge pull request #5 from sprintly/promise-rejection

Reject the deferred in the event of an error.