• 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: DO, replyWithException and oneway void message...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DO, replyWithException and oneway void message...


  • Subject: Re: DO, replyWithException and oneway void message...
  • From: email@hidden
  • Date: Fri, 21 Oct 2005 13:28:33 +1000

if the message is oneway void, you can not return an exception with - (void)replyWithException:(NSException *)exception... too bad, but somewhat logic ;)

i'll have to make the server message the client asynchronously with something like server:(id)aServer remotelyRaiseException:(bycopy NSException*)anException...

The problem you'll have is the same one they must have had when they were implementing DO - where do you insert this exception? Exceptions shouldn't randomly occur wherever there's an available exception handler; they're hierarchal and scoped.


These sort of things are best handled by higher level protocols. Failing that, a reasonable default behaviour is to simply ignore inappropriate messages, and/or provide some flag to the destination object indicating an inappropriate method was called... you could try using doesNotRecognizeSelector:, but the default implementation will raise a server-side exception. D'oh. I don't know if DO catches that and does anything with it - I hate exceptions myself, so I code so they don't happen. :)

I'd suggest your delegate implement the policy for handling it. Either ignore it, close the connection, or whatever. There's not really much of a way around it... if a client is sending you inappropriate messages, then it's either (a) malicious or (b) buggy. Depending on how much you trust your own code and how paranoid you are, would determine whether you disconnect them or just ignore it. :)

I'd vote for disconnection myself, unless you have legitimate cases where you might send an inappropriate message; e.g. version conflicts, etc.

Wade Tregaskis

    ICQ: 40056898
    AIM, Yahoo & Skype: wadetregaskis
    MSN: email@hidden
    iChat & email: email@hidden
    Jabber: email@hidden
    Google Talk: email@hidden

    http://homepage.mac.com/wadetregaskis/

-- Sed quis custodiet ipsos custodes?


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >DO, replyWithException and oneway void message... (From: Aurélien Hugelé <email@hidden>)
 >Re: DO, replyWithException and oneway void message... (From: Aurélien Hugelé <email@hidden>)

  • Prev by Date: Re: NSBezierPath containsPoint?
  • Next by Date: Re: Authenticate a user
  • Previous by thread: Re: DO, replyWithException and oneway void message...
  • Next by thread: REPOST: loadNibNamed and retain counts
  • Index(es):
    • Date
    • Thread