Create your own error handler.
Here is a sample to show datawidth error any where in the software but continues with execution without closing.
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local bOldErr := ErrorBlock()
MsgInfo( "Start Test" )
// Set this at the start of the main module
ErrorBlock( { |e| MyErrorHandler( e, bOldErr ) } )
RDDSetDefault( "DBFCDX" )
DbCreate( "T.DBF", { { "NUM", "N", 2, 0 } } )
USE T
APPEND BLANK
T->NUM := 1000 // This line normally produces runtime error.
CLOSE DATA
msginfo( "End of Program" )
return nil
function MyErrorHandler( e, bOldErrHandler )
if e:SubCode == 1021
MsgAlert( e:Description + CRLF + ;
"FIELD : " + e:Operation + CRLF + ;
ProcName( 2 ) + CRLF + ;
"Line : " + LTrim( Str( ProcLine( 2 ) ) ) )
// Decide what the programmer wants to do here
return .f.
endif
return Eval( bOldErrHandler, e )