Handling database errors

I wonder if anybody has managing database errors. For example: I add a new record which is set UNIQUE attribute in the table. The database (in my case MySQL) generates an error (along with the Errorcode() ) and SC App - pops up a message like the one below.

[ATTACH=CONFIG]n69240[/ATTACH]

I would like to replace this message with my own (custom message).
In this case I would like to read the Errorcode() from MySQL and based on that display Message(1) OR Message(2) if the code is different.
I looked up the MACRO HELP but the descriptions are all garbage. It seems like the one who wrote the help for macro was drunk!
BTW. I need to read the database ErrorCode() NOT the ErrorString() and based on that display proper message. This seem to be super simple to do but somehow SC does not handle SQL errors very well and the customization is inconvenient.

Any tips how to do it ?
TNX

ErrorCode.png

Hello aka… have you tried this?..

[ATTACH=CONFIG]n69253[/ATTACH]

messages.png

I haven’t tried this, thanks. This seem to be somewhat helpful but does not provide any user interaction. I would like to be able user to resond (ie.e YES/NO or OK/CANCELL). I think having a Macro would be very helpful. I would love to see something like:

sc_dberror(Parameter1, Param2) where Param1 is database Errornumber()

Another problem is that this simple error handling is available only for forms while there is no way to do the same for other Apps :frowning:

ARTHUR

agreed:

There another problem it should have an option like “Redirect in case of error”. Dont you think?

Regards

Yes I agree ! So far database errors are left completely alone and this becomes urgent.