Hi ALL!


My Outsystems version is 10.0.910.0


My Problem is when I use advanced SQL to delete one record, it show me the message in error page.


"Error executing query"


That's all it shows, nothing else. But I want the detail message.


And I open the error log, I found it has two messages


  1. 2020-06-01 11:09:44 169 Error executing query
  2. 2020-06-01 11:10:00 169 Error executing query..... XXX..... ORA-02292: integrity constraint (xxxx) violated - child record found


So it catches the useful exception internal.


In our project, we want to catch the useful exception, and then do our logic, and show our own message instead.


Somebody has any idea?


Thanks!!!


Hi Bob,

Within your Action flow were you defined the Advance SQL Node, I think you missed defining the Exception Handling Flow. By defining the Exception Handler Flow you can showcase the end-user with custom or User-friendly Error message.

Hope this helps you!

Regards

Benjith Sam

Hello Bob.

You can set more specific error handling. Database exception for example.

And then you use the output DatabaseException.ExceptionMessage



Hi Bob,

Before going to the exception handling part you should first check the error and understand if your code should be improved in order for this error to not happen at all. TechOnTheNet is a cool site that helps decipher errors from different database stacks, here's the page for the error you had: https://www.techonthenet.com/oracle/errors/ora02292.php

As you can see the error is because the user is trying to delete a record that has an Foreign Key to a record that still exists. Probably the delete action should not be available when that's the case.


Regarding exception handling, I'd advise going through the online lessons in this course: https://www.outsystems.com/learn/lesson/1829/logic-and-exception-handling

Benjith Sam wrote:

Hi Bob,

Within your Action flow were you defined the Advance SQL Node, I think you missed defining the Exception Handling Flow. By defining the Exception Handler Flow you can showcase the end-user with custom or User-friendly Error message.

Hope this helps you!

Regards

Benjith Sam

Sorry Benjith, I tried, but the messagetext is "Error executing query", that is to say, after the advanced sql it runs into databaseException, and the advanced sql catches the useful exception and rethrow another message. and the message is cathced by databaseException.


Hi Bob,

Could you please go through the below thread if that helps your query.

https://www.outsystems.com/forums/discussion/39240/getting-error-from-service-center-to-display-at-screen/

Nuno Reis wrote:

Hello Bob.

You can set more specific error handling. Database exception for example.

And then you use the output DatabaseException.ExceptionMessage



Hi Nuno, I tried, I add one user exception, and add to my action, but after excute the sql, the error page shows, the user excetion can not catch the db exception. can I custom a db exception?


Suprio Roy wrote:

Hi Bob,

Could you please go through the below thread if that helps your query.

https://www.outsystems.com/forums/discussion/39240/getting-error-from-service-center-to-display-at-screen/

Hi Suprio, I follow the link, and add the Log_Error to my module, after publish, the error shows "You are not allowed to use the Entity Log_Error"


Hi Bob,

There's no way to get the actual SQL error in this case. But like Cristiana wrote, this error shouldn't happen in the first place. It would be very bad user experience if a normal user would be shown a "ORA-02292: integrity constraint (xxxx) violated - child record found" error on the screen. You should prevent errors like this from happening at all, and explain the user why a certain action is not possible.

That said, you should be questioning why you want to use Advanced SQL for deleting a record, instead of using a DeleteXxx Entity Action.

Kilian Hekhuis wrote:

Hi Bob,

There's no way to get the actual SQL error in this case. But like Cristiana wrote, this error shouldn't happen in the first place. It would be very bad user experience if a normal user would be shown a "ORA-02292: integrity constraint (xxxx) violated - child record found" error on the screen. You should prevent errors like this from happening at all, and explain the user why a certain action is not possible.

That said, you should be questioning why you want to use Advanced SQL for deleting a record, instead of using a DeleteXxx Entity Action.

We have two databases and they have same qualities of entities and entities have same attributes, if I use DeleteXxx I must use the default atrribute "id", that is mismatching to another database. So I can only use SQL.The purpose of get the exception message is i want the "ORA-02292" and base on this i will do some logic and show another message that the nomal user can understand. I don't want do check before the exception happens because my foreign key is a lot, I dont't want to check them one by one.