-
Notifications
You must be signed in to change notification settings - Fork 585
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
Exceptions thrown in the native code #1117
Comments
As the exception explains, you can't create two objects with the same primary key but have to update it once it's been created the first time. Changing your code is the only way to handle that exception. Now sure what else you expect to be able to do? |
Yea, that is clear. The Problem is that the only way to work again with the app is stoping it and re-launching it through xCode. Is there a way to continue with the execution? Can I catch those exceptions in the js code? |
The native exceptions should be translated to JavaScript exceptions. This might be a bug or a regression. I'll add it to the backlog for further investigation. |
@fealebenpae - on the subject of exceptions not being translated to Javascript exceptions: #1095 - it happens here as well. |
Well, that’s not in Realm code, or called by Realm code. |
The bug is likely that this particular exception in the |
To be honest - I haven’t seen a single exception yet in JS… Everything is
throwing me in XCode
On 5. July 2017 at 11:26:58, Yavor Georgiev ([email protected]) wrote:
The bug is likely that this particular exception in the create path is not
rethrown in JS. There are lots of other C++ exceptions that do get rethrown
in JS.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1117 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAqWCnu5bnQfkkXHnEBUVfINsQlzgYiQks5sK1bhgaJpZM4ONewo>
.
|
Huh. You wouldn’t happen to have an exception breakpoint activated in the Xcode Debug Navigator? |
Not that I know of:
|
Do you get the same problem if you create a new project? |
This: #1095 is definitely happening on a new project( RN 0.45 and realm only) But I couldn't recreate the exception throwing with create on a new project. The exceptions are properly shown in the simulator. Now go figure why this shit happens on one project, but not in the other... :( |
if you can please send your projects to [email protected]. |
My hunch is that your Xcode project decided to break on every exception thrown, even if it is later caught and rethrown in JavaScript. |
@fealebenpae - it doesn't brake on RN exceptions? Just on RealmJS exceptions. |
Hey guys,
Realm is throwing exceptions in the native ios code. As such my app execution halts and I can see the error in xCode. It's ok, since I can see the error and decide how to continue, but the problem is that whenever I hit "continue program execution" I end up at the same error.
I was clicking here like a monkey for at least 100 times and I always end up in the same exception. I have to stop the app and start it.
In this particular case I'm doing this:
database.write(() => {
database.create('Company', value);
})
I tried to save value twice both with the same id key and I run into else if (!try_update) {
throw std::logic_error(util::format("Attempting to create an object of type '%1' with an existing primary key value '%2'.",
object_schema.name, ctx.print(*primary_value)));
}
I saw that I need to pass a third argument true if I want realm to magically update my object instead of creating it again. But now I have to stop the app to retry. How are we supposed to deal with those exceptions?
The text was updated successfully, but these errors were encountered: