objective c - NSError from HTTP status code -


what's best way create nserror object based on standard http status code (ideally 1 includes human-readable message in localizeddescription)? there standard method or should create own error domain use nserror?

foundation's objects performing network requests return these nserrors you. nsurlconnection, example, provide nserror in completionhandler of +sendasynchronousrequest:queue:completionhandler: method.

if you'd roll own create instance of nserror, set error domain nsurlerrordomain, set code http status code want, , set localizeddescription human readable string need.