To answer my own question, I wrote a wrapper for SAVE RECORD in the database structure which basically looks like this:
`4D_SAVE_RECORD `Wrapper for 4D's SAVE RECORD command. `Saves a record and returns any error code encountered.
C_LONGINT($0;$error) C_POINTER($1;$tablePTR) $tablePTR:=$1
DB_ERROR:=0 ON ERR CALL("DB_ON_ERROR") SAVE RECORD($tablePTR->) ON ERR CALL("") $0:=DB_ERROR
The active 4D Code now looks like:
<%
If (Defined ($f_locsite_submit))
create record ([LOCATION_SITE])
[LOCATION_SITE]locsite_name:=$f_locsite_name
[LOCATION_SITE]locsite_descript:=$f_locsite_descript
$error:= 4D_SAVE_RECORD (->[LOCATION_SITE])
if ($error=0)
unload record ([LOCATION_SITE])
else
write_save_error($error) `uniform error message handler
end if
end if
%>
If anyone has any better ideas I'd love to hear them.
Actually, the standard Active4D shell wraps all calls to Active4D with ON ERR CALL("A4D_ErrorHandler") and initializes A4D_Error so you can check the value of A4D_Error within your Active4D code. You may have removed that code in your modifications to the shell. I think if that were in place you wouldn't have to use a wrapper around SAVE RECORD, you would just do this:
SAVE RECORD([LOCATION_SITE])
if (A4D_Error=0)
`etcThis has the advantage of catching all errors that occur within Active4D (which as you have seen is critical), not just the ones you wrap.
Regards,
Aparajita Victory-Heart Productions [EMAIL PROTECTED] www.aparajitaworld.com
"If you dare to fail, you are bound to succeed." - Sri Chinmoy | www.srichinmoylibrary.com
