Reject the promise on errors