Here is the technique that I have employed which works well for me.
- Create your own set of classes based upon whatever base you choose.
- replace the error method with code like this:
lparameters nError, cMethod, nLine, toobj
if vartype(toobj) <> 'O'
toobj = this
endif
if type('this.parent.name') = 'C'
if inlist(this.parent.baseclass+'|','Page|','Column|')
lcRetval = this.parent.parent.error(nError, cMethod, nLine, toobj)
else
lcRetval = this.parent.error(nError, cMethod, nLine, toobj)
endif
else
if type('goapp.name') = 'C'
lcRetval = goApp.error(nError, cMethod, nLine, toobj)
else
lcRetval = 'X'
endif
endif
if vartype(lcRetval) = 'C' and not empty(lcRetval)
do case
case toobj = this and lcRetval = 'S'
set step on
return
case toobj = this and lcRetval = 'R'
retry
case toobj = this and inlist(lcRetval,'X','A')
cancel
otherwise
return lcRetval
endcase
endif
- Create a global error handler for presenting and documenting the error.
- Add code to "Handle" errors which can be managed at this level and if not handled return DoDefault(nError, cMethod, nLine, toobj)
This is not a complete dissertation on error handling but a suggestion of an approach which works for me.
Glenn
>Hi guys...
>
>I want to know about how to create or make some error handling by ourself... accordingly to the huge error traping number in VFP but basely i want to make some error handling to networking error, file error and less more...
>
>thanks,
>i'll be thankfull if any of you help me..
>
>regards,
>tut_arie