KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Help users report bugs accurately
PRODUCT: 4D | VERSION: 13.0 | PLATFORM: Mac & Win
Published On: August 13, 2012

One challenge database users face is to accurately report back to the developer the full details of an error when it occurs. With a little bit of planning and coding the developer can make it much easier for the user to provide accurate feedback to the developer following an error.

The image below is an example of a dialog that could be incorporated to an error handling routine. It contains the variables made available to the error handler (Error, Error method and Error line) plus a List Box that contains the Error stack.

What is really important for getting the information back to the developer is the "Copy to Clipboard" button.



The code below is the code contained in Error handler.

C_LONGINT(Error_L;ErrorLine_L)
C_TEXT(ErrorMethod_T;Msg_T)

// Copy the 4D system variables in the dialog variables
// (
ErrorCode_L:=Error
ErrorMethod_T:=Error method
ErrorLine_L:=Error Line
// )

ARRAY LONGINT(Codes_aL;0)
ARRAY TEXT(IntComp_aT;0)
ARRAY TEXT(Text_aT;0)
GET LAST ERROR STACK(Codes_aL;IntComp_aT;Text_aT)

Msg_T:="Error "+String(ErrorCode_L)+" while executing the method \""+\
    ErrorMethod_T+"\" at line number "+String(ErrorLine_L)

Msg_T:=Msg_T+"\rPlease report this error information to the developer ASAP."

// Display the error dialog
// (
DebugAlert
// )


The code below is from the "Copy to Clipboard" button.

$Msg_T:=String(Current date;System date short)+" @ "+String(Current time;HH MM SS)+"\r"
$Msg_T:=$Msg_T+Current user+" on "+Current machine+"\r\r"

$Msg_T:=$Msg_T+"Error: "+String(ErrorCode_L)+"\r"
$Msg_T:=$Msg_T+"Method: \""+ErrorMethod_T+"\r"
$Msg_T:=$Msg_T+"Line number: "+String(ErrorLine_L)+"\r\r"

$Msg_T:=$Msg_T+"Error stack: \r"
$Msg_T:=$Msg_T+"Error\tInternal Comonent\tError message\r"
For ($Ndx;1;Size of array(Codes_aL))
    $Msg_T:=$Msg_T+String(Codes_aL{$Ndx})+"\t"
    $Msg_T:=$Msg_T+IntComp_aT{$Ndx}+"\t"
    $Msg_T:=$Msg_T+Text_aT{$Ndx}+"\r"
End for

SET TEXT TO PASTEBOARD($Msg_T)


Now the user has accurate information to add to an email to IT or the developer.

See Also: