# Error Handling

## Error Notifications

Errors are communicated through notifications. We recommend that you read NSNotificationCenter Class Reference first.

Create a method to handle these notifications. The notification will contain a key-value pair in the userInfo dictionary with the key CJGuestCallErrorKey. The value of this pair is the actual NSError instance. The error code is enumerated by CJGuestErrorCode. In the code below the description of the error is logged.

    - (void)handleError:(NSNotification *)notification
    {
        NSError * error = [[notification userInfo] valueForKey:CJGuestCallErrorKey];

        NSLog(@"Jabber Guest error: %s", error.localizedDescription.UTF8String);
    }

To receive the notification, add an observer using the method you created to handle the notification as the selector, for the notification CJGuestCallErrorNotification.

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleError:) name:CJGuestCallErrorNotification object:nil];

## Logs

Jabber Guest logs diagnostic information in the Application Support directory of your app. It creates a Logs sub-directory and places dated text files with the .log extension into it.

You can retrieve these logs through the Organizer. Or, if you need to programatically retrieve the logs, you can use [CJGuestCall getAllLogs] to get an array of file names for every Jabber Guest log file on the device.