سؤال

I would like to subclass NSException and use it in my app for the application specific errors or exceptions.

Is it right way to do so? If YES, how to do it in a better way. If NO, why it is not the right way and whats the alternate for it?.

Please guide me !

Thanks.

هل كانت مفيدة؟

المحلول

Do not use exceptions for recoverable errors.

So, yes, there is a better way. Exceptions should only be used for fatal errors. Other kinds of error handling is done via the NSError** pattern.

CodaFi's answer (Is it a good practice to subclass from NSException for app-specific exceptions?) has more details.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top