• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Handle errors within NSURLConnection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handle errors within NSURLConnection


  • Subject: Re: Handle errors within NSURLConnection
  • From: "Michael Ash" <email@hidden>
  • Date: Sun, 27 Jul 2008 23:05:31 -0400

On Sun, Jul 27, 2008 at 8:03 PM, Dennis Davydenko
<email@hidden> wrote:
>>
>> Hi guys!
>>
>> I'm kinda new to Cocoa framework. I'm trying to create an application that
>> will send requests to my web server. Everything is cool, except error
>> handling. I would assume that any error while request is being sent should
>> trigger didFailWithError, but it seems it is not what happening. Instead I
>> got connectionDidFinishLoading and no errors. I tried to use
>> didReceiveResponse and extract statusCode of response - that worked, but if
>> I want to handle all possible HTTP error statuses (like 401, 403, 404, 500
>> and so on) I will have to create all this handling on my own... I think I'm
>> missing something here - there should be some classes that are implemented
>> to  perform this job... or I'm too naive?
>>
>> Any advices are appreciated!

While those could be considered HTTP errors, they are not connection
errors. didFailWithError: is for things like connection refused,
connection reset, etc. If you get a 404, the HTTP connection did not
encounter any error. It received a 404 status code (which is
legitimate), and some data in response to its request. What you do
with that code/data is then up to you.

So it all depends on what you want your error handler to do. Figure
that out, then write some code to do it. As an HTTP client you will
need to know what codes are "good" and what codes are "bad", that's
just how it is.

Mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Handle errors within NSURLConnection (From: Dennis Davydenko <email@hidden>)

  • Prev by Date: Re: NSArray problems
  • Next by Date: Re: NSArray problems
  • Previous by thread: Handle errors within NSURLConnection
  • Next by thread: Working with mathematical errors
  • Index(es):
    • Date
    • Thread