title: How to make webservice pass errors through NSURLConnection's connection:didFailWithError:?
body: <p>What does a web service need to do to cause <code>NSURLConnection's</code> delegate to receive the <code>connection:didFailWithError:</code> message?</p>
  
  <p>For example:
  iOS app passes a token to the web service, web service looks up the token, and then the web service needs to respond with an error saying "invalid token" or something of the like.</p>
  
  <p>Currently, the data is received, and in "<code>connectionDidFinishLoading</code>:" is parsed for error messages. This means I'm error checking in two places, which I am trying to avoid.</p>
  
  <p>I have both the iOS app and web service completely under my control.</p>