Behaviour of mdataEntryActionsInsert/mdataEntryActionsUpdate if the key already exist/not exist

I am experimenting with the Java API. I am unable to find documentation about mdataEntryActionsInsert/mdataEntryActionsUpdate (NativeBindings) and how they are expected to behave.
For example, if mdataEntryActionsInsert is called for a key that already exist, will it produce error or silently make an update?
Similarly for mdataEntryActionsUpdate, if the record does not exist, what is the expected behaviour?


Hey @ogrebgr!
Thanks for reaching out.

For insert and update entry actions, instead of using the functions in NativeBindings you can use their equivalent wrappers:
Session.MDataEntryActions.insert() for insertion and
Session.MDataEntryActions.update() for update.

You can find the rest of the entry action functions and their documentation in the API docs.

If you try to insert an entry with a key that already exists then an EntryExists exception will be thrown.
When you call the update API with a non-existent key you’ll get a NoSuchEntry exception.

Let us know if you have any more questions :slight_smile:


Hi @lionel.faber,

Thanks for your answer.
I am not using Session because I am trying to create simpler wrapper API around NativeBindings.

About the exceptions: I cannot fine anywhere EntryExists, NoSuchEntry classes. Are they part of the rust? BTW, in more general perspective - it is not clear each method what error may produce (or at least I cannot find such info). Is this documented somewhere or it is only available in the Rust sources/docs?


Ah I see.
There are no error classes at the Java layer. These exceptions originate in Rust and are sent across the FFI as FfiResult objects and are handled in Java by a helper class.

You can find the different kinds of errors and their error codes across files in safe_client_libs.