Hi there.
I’m not able to determine “where” an exception occurred in a system. As an example I create a simulation of this:
I have a “master” form say FormPrinc “As Top-Level Form”. In config.fpw I have a screen=off.
In this form I have 2 command buttons each one calls secondary form (say Form1 and form2) defined as “In Top-Level Form”
And my “main program” is:
[tt]TRY
TRY
ENDTRY
[/tt]
My problem is when an error occurs in form1 or form2 I can’t determine where the error happened. I would like to close the “error form” showing an error message and be able to continue the system, closing only the problematic form.
In the “main” form I call the child form this way (thought a command button):
[tt]TRY
Of course this “CATCH” only occurs if there is an error in the INIT of the form. Any other error that “may occurs” during the FORM’s operation is “CATCHED” by the main Program (because the child forms are “In Top-Level Form”, but I can’t know from where.
Any suggestion how I can know where (in witch child form) the error occurred?
I’m leaving a sample here:
Thx
Mauro
I’m not able to determine “where” an exception occurred in a system. As an example I create a simulation of this:
I have a “master” form say FormPrinc “As Top-Level Form”. In config.fpw I have a screen=off.
In this form I have 2 command buttons each one calls secondary form (say Form1 and form2) defined as “In Top-Level Form”
And my “main program” is:
[tt]TRY
DO FORM formprinc NAME formprinc
READ EVENTS
CATCH TO oErrREAD EVENTS
CRLF = CHR(13)+CHR(10)
cStr = "Error Catch Test" + CRLF + ;
"[ Error: ] " + STR(oErr.ErrorNo) + CRLF + ;
"[ LineNo: ] " + STR(oErr.LineNo) + CRLF + ;
"[ Message: ] " + oErr.Message + CRLF + ;
"[ Procedure: ] " + oErr.Procedure + CRLF + ;
"[ Details: ] " + oErr.Details + CRLF + ;
"[ StackLevel: ] " + STR(oErr.StackLevel) + CRLF + ;
"[ LineContents: ] " + oErr.LineContents
MESSAGEBOX(cStr )
ENDTRY cStr = "Error Catch Test" + CRLF + ;
"[ Error: ] " + STR(oErr.ErrorNo) + CRLF + ;
"[ LineNo: ] " + STR(oErr.LineNo) + CRLF + ;
"[ Message: ] " + oErr.Message + CRLF + ;
"[ Procedure: ] " + oErr.Procedure + CRLF + ;
"[ Details: ] " + oErr.Details + CRLF + ;
"[ StackLevel: ] " + STR(oErr.StackLevel) + CRLF + ;
"[ LineContents: ] " + oErr.LineContents
MESSAGEBOX(cStr )
TRY
formprinc.release
CATCH ENDTRY
[/tt]
My problem is when an error occurs in form1 or form2 I can’t determine where the error happened. I would like to close the “error form” showing an error message and be able to continue the system, closing only the problematic form.
In the “main” form I call the child form this way (thought a command button):
[tt]TRY
DO FORM form1
CATCH
MESSAGEBOX("Error Form1")
ENDTRY[/tt]
Of course this “CATCH” only occurs if there is an error in the INIT of the form. Any other error that “may occurs” during the FORM’s operation is “CATCHED” by the main Program (because the child forms are “In Top-Level Form”, but I can’t know from where.
Any suggestion how I can know where (in witch child form) the error occurred?
I’m leaving a sample here:
Thx
Mauro