if response is error, reject promise with ErrorResponse