Ans :
Exception and Error is of course different. Following explanation in given for considering Objective-C.
Exception : Exceptions cause applications to crash if left unhandled. They generally occur when trying to perform an operation on an object incorrectly, such as using an out-of-bounds index to access an array item, or passing nil to a method that doesn’t accept it. In other words, they are caused by developer mistakes. Unhandled exceptions in your published apps must be avoided at all costs.
They are warnings to developers that a serious coding issue has occurred and needs to be fixed. They are expected to occur during development of you application, and provide information that will help you solve the issue before shipping your app.
In Objective-C, NSException is there to handle unwanted exception. This class contains 3 key points of information :
Name : Name identifies the type of exception that has occurred. The name property is used as the high level categorization.
Reason : Reason is a short explanation of why the exception has been thrown. For example “+[Class Selector] unrecognized selector sent to class 0x10866fb88”.
Userinfo : UserInfo is an NSDictionary of additional information that can help to debug the problem.
Error : Errors don’t get thrown, and they don’t cause the application to crash. They are created to hold information about a failure
Errors in iOS are represented by the NSError class which provides these 3 properties:
domain is a high level grouping of errors.
code is used to distinguish different types of errors within a domain.
userInfo is an NSDictionary containing additional information about the error.
Exceptions are caused by programming faults, and must be fixed or handled. Errors are expected to happen from time to time and should be dealt with accordingly.
Exception and Error is of course different. Following explanation in given for considering Objective-C.
Exception : Exceptions cause applications to crash if left unhandled. They generally occur when trying to perform an operation on an object incorrectly, such as using an out-of-bounds index to access an array item, or passing nil to a method that doesn’t accept it. In other words, they are caused by developer mistakes. Unhandled exceptions in your published apps must be avoided at all costs.
They are warnings to developers that a serious coding issue has occurred and needs to be fixed. They are expected to occur during development of you application, and provide information that will help you solve the issue before shipping your app.
In Objective-C, NSException is there to handle unwanted exception. This class contains 3 key points of information :
Name : Name identifies the type of exception that has occurred. The name property is used as the high level categorization.
Reason : Reason is a short explanation of why the exception has been thrown. For example “+[Class Selector] unrecognized selector sent to class 0x10866fb88”.
Userinfo : UserInfo is an NSDictionary of additional information that can help to debug the problem.
Error : Errors don’t get thrown, and they don’t cause the application to crash. They are created to hold information about a failure
Errors in iOS are represented by the NSError class which provides these 3 properties:
domain is a high level grouping of errors.
code is used to distinguish different types of errors within a domain.
userInfo is an NSDictionary containing additional information about the error.
Exceptions are caused by programming faults, and must be fixed or handled. Errors are expected to happen from time to time and should be dealt with accordingly.