Sorry for the multiple posts everyone. ISP problems.
To be more specific, I am using the new-style exceptions (@throw,
@try, @catch) with subclasses of NSException. The only way to know
right now if I'm @catch-ing all exceptions is to look at the
documentation and ensure I'm catching everything I need to. In Java,
I can just:
If I then fail to catch MyException and YourException when calling
someFunc(), the compiler complains, making it easy to fix the
problem. If I forget in obj-c, I don't know until something causes
the exception to throw during runtime.
I haven't had much luck finding a throws keyword to do this (pretty
sure it doesn't exist). Sans that, does anyone have a design pattern
or programming habit I can adopt to do basically the same thing?
On May 14, 2007, at 6:55 ☽ PDT, Jonathan deWerd wrote:
-----BEGIN PGP SIGNED MESSAGE-----
The short answer: you can't.
But why do you need to know this? Perhaps if we knew more about
what you were trying to do we could give you a better answer.
Exceptional behavior is handled very differently in Objective C and
Java, so if you haven't already read the documentation dealing with
use of exceptions, errors, and nil (look in topics of NSException
and NSError documentation) then it might be helpful.
Good luck with your project,
On May 14, 2007, at 6:54 PM, Mike Manzano wrote:
Does anyone know how to force the compiler to check that a
specified exception is thrown from a method?
I'm looking for something similar to the Java "throws" keyword.
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden