Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top