Hello all,
My entity is having UNIQUE Index on two attributes
Below is my server action to create new person record
Below is my client action which is using above server action when clicked on save button
So my doubt is when i'm trying to insert duplicate records with only DataBaseExcection handler on my action, exception is not being handled
but when I added all exceptions handler it's coming over here
I think UNIQUE kind of thing is DB Exception & it should be handled by DataBaseExcection handler
Please help me if I'm missing something.
-- As build version is not showing in the above platform version dropdown, I'm attaching screeshot
Attaching my OML
Thanks.
Exactly, and it should. It may be some bug of the platform/version.
Hello @sjeevan sai,
Good observation, and it has to do with what is in scope of a client action vs. server action.
The database exception will be caught if you move the exception handling to the 'AddPerson' server action
Regards,
AJ
Hello.I experimented a bit with your example and you definitely have a point.It seems that the exception, when thrown by the server but handled by the mobile device, doesn't allow to determine the type. Something like what is described on this documentation, even though it isn't specifically described by it. (https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Handle_Exceptions/Exception_Handling_Mechanism)
I tried to catch the exception on Server Side (Inside the "AddPerson" Action) and it got caught by the DatabaseException as expected. I don't know if any of this helps you but I think that you can do as described on the image if it fits your requirements.Best regards.
Hi @sjeevan sai, Good catch!!
I tried to play with your OML and seems like the Database Exception is working fine when calling inside the scope of Server Action(i.e AddPerson) as here with this example the Database query is being executed at the server-side.
As mentioned in the Outsystems documentation.
Thanks & Regard
Nitish Kumar
The flow in the documentation is clear. It should have followed the yellow path and raised a database exception.
Hi Jeevan,
Please report this bug via Service Studio (click the Feedback button) and/or open a Support Case in the Support Portal. This will put it on the OutSystems backlog.
Seems like it's resolved now.