• 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: try/catch/throw/finally example?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: try/catch/throw/finally example?


  • Subject: Re: try/catch/throw/finally example?
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Sat, 26 Aug 2006 09:02:19 +0200


On 26 Aug 2006, at 04:31, Todd Yandell <email@hidden> wrote:



On Aug 25, 2006, at 12:38 PM, Roland Silver wrote:

Can someone suggest a tutorial or example of the use of @try,
@catch, @throw, @finally, in Objective-C, other than the Apple
document "Exception Handling and Thread Synchronization"?

NSString *stringOne = @"One"; NSString *stringTwo = @"Two";

@try {
    [stringOne appendString:stringTwo];
} @catch (id theException) {
    NSLog(@"%@ doesn't respond to appendString:!", [stringOne class]);
} @finally {
    NSLog(@"This always happens.");
}


How is this different from:

@try {
    [stringOne appendString:stringTwo];
} @catch (id theException) {
    NSLog(@"%@ doesn't respond to appendString:!", [stringOne class]);
}
NSLog(@"This always happens.");

that is: what is the @finally clause good for, as the next statement after the @try block also gets executed in all cases?

Or what am I missing?

Geriet.

_______________________________________________
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


  • Follow-Ups:
    • Re: try/catch/throw/finally example?
      • From: Cameron Hayne <email@hidden>
  • Prev by Date: Re: Detecting non-responsive app
  • Next by Date: ftp to Linux machine with utf-8 encoding characters in the filename
  • Previous by thread: Xcode 101 (Was: try/catch/throw/finally example?)
  • Next by thread: Re: try/catch/throw/finally example?
  • Index(es):
    • Date
    • Thread