PostgreSQL - ODBC - Error codes empty after PARENT.TakeCompleted()

Hello.
Many years ago I programmed in Clarion (legacy).
Recently I started again with Clarion 11 - ABC.
I use postgresql database, odbc driver.
Of course, at the beginning the problem of error interception needs to be solved.
Clarion does not have ON ERROR().
I am doing an insert and intentionally entering a duplicate key.
PARENT.TakeCompleted() does everything, returns a text error, the correct code (23505).
After PARENT.TakeCompleted() FILEERRORCODE() and FILEERROR() are empty.
How can I return a text error and an error code after PARENT.TakeCompleted(), so that I can manage them.
I would be grateful if someone could help me.

These links might help you get up to speed with the ABC OOP classes.

Have a look at the FileManager class method TakeCompleted clw and see what its doing.

The FILEERRORCODE() and FileError() is what the class uses and populates the class properties with, but you can also use the ErrorClass.

Look at the errorclass GetErrorCode and GetError methods. You can call these after calling the File Manager methods.

A suggestion is to also catch the Dup in the OK button and give the user a nice message:

IF MST:SSN AND DUPLICATE(MST:SSNKey)
   Select(?MST:SSN)
   Message('You already have an Employee with Social Security No. ' & MST:SSN , 'Alert')  
   CYCLE 
ELSIF MST:ClockNo AND DUPLICATE(MST:ClockNoKey)
   Select(?MST:ClockNo)
   Message('You already have an Employee with Time Clock Number ' & MST:ClockNo , 'Alert')  
   CYCLE 

Sometimes I use an Alias to GET the Dup record so I can provide more information.

Thanks, I’ll read it.

Thanks, I’ll read it.