Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation by commendign to use try/catch #26

Open
buguibu opened this issue Jan 29, 2015 · 0 comments
Open

Improve documentation by commendign to use try/catch #26

buguibu opened this issue Jan 29, 2015 · 0 comments

Comments

@buguibu
Copy link

buguibu commented Jan 29, 2015

I've been dealing with an invisible error in this code

RLMRealm *realm = [RLMRealm defaultRealm];
[realm beginWriteTransaction];
[self createOrUpdateInRealm:realm withJSONDictionary:serverResponse];
[realm commitWriteTransaction];

until i used try/catch for receive the "Invalid value" exception like this:

RLMRealm *realm = [RLMRealm defaultRealm];
[realm beginWriteTransaction];
@try
{
    [self createOrUpdateInRealm:realm withJSONDictionary:serverResponse];
}
@catch(NSException *exception)
{
    NSLog(@"Couldn't import due to exception: %@", exception.description);
}
@finally
{
    [realm commitWriteTransaction];
}

Maybe it has been due to, for some reason, that during testing some RLMExceptions do not raise, i don't know, but i'll asume this as a best practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant