Handling Errors

There are two types of errors that the Database Manager let you known.

Fatal Errors or Exceptions

This is are errors that will prevent the Database Manager or your application to work correctly. On most part of cases you're trying to retrieve some data that doesn't exist or something like that. So an exception (NSException) is raised and if isn't catched will interrupt your application. You always can use an try..catch block to avoid that.

This is are the exceptions raised by the Manager. This exceptions are defined on JPDBManagerDefinitions.h file.

JPDBManagerActionException

This kind of exception is raised when is impossible to perform an Database Action.

JPDBManagerStartException

This kind of exception is raised when is impossible to start the Core Data environment.

JPDBInvalidInitiator

This kind of exception is raised when you try to use some 'init' method that is protected. From an Abstract or an Singleton Class for example.

Errors

This is are errors that doesn't prevent the Database Manager or your application to work correctly. If you doesn't handle this errors they will be logged to the console, nothing else.

To handle this errors you should sign to the NSNotificationCenter with the JPDBManagerErrorNotification Key to receive detailed information. This Key is defined in JPDBManagerDefinitions.h file.

The Database Manager post an NSNotification when some error ocurr performing one operation.

The NSNotification object encapsulate an NSError with the cause and description. You can retrieve the manager that generates the error acessing the JPDBManagerErrorNotification Key on the userInfo dictionary.