Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enhancing error handler
Message
From
29/05/2021 17:45:30
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01680822
Message ID:
01680825
Views:
57
In the long run you are painting yourself into a corner with an approach based on adding to or modifying current parameter list.

Speaking with no knowledge on Dougs class, I would bet small amounts that ANY subclass approach is better, from simply overwriting
function ini()
local llOk
llOk = dodefault()
this.Addobject("oDmitry", "empty")
return m.llOk

function ErrorHandler(tnError, tcSys16, tnLineno)
= AddProperty(this.oDmitry, "cAlias", Alias())
return dodefault(m.tnError, m.tcSys16, m.tnLineno)
over a hook based approach
function ErrorHandler(tnError, tcSys16, tnLineno)
local luRet
this.Hook_ErrorHandler_Before(m.tnError, m.tcSys16, m.tnLineno)
luRet = dodefault(m.tnError, m.tcSys16, m.tnLineno)
this.Hook_ErrorHandler_Done(m.tnError, m.tcSys16, m.tnLineno)
return m.luRet
to a construct where you set specific objects for each hook type or before/done
function ErrorHandler(tnError, tcSys16, tnLineno)
local luRet
this.oHookBefore.ErrorHandler(m.tnError, m.tcSys16, m.tnLineno)
luRet = dodefault(m.tnError, m.tcSys16, m.tnLineno)
this.oHookDone.ErrorHandler(m.tnError, m.tcSys16, m.tnLineno)
return m.luRet
in your specific .Init due to another settings object as factory specifying each class, allowing you more freedom in subclassing/specialising. Yes, last approach IS overenginered on purpose to give you an idea how far you might proceed for problems having much wider application range...
>In my application I use the error handler class developed by Doug Hennig many years ago. It is good and it serves/served the purpose. Over the years I add ed some code but for the most part it is the same.
>
>I want to add the logging of the ALIAS() at the time of the error. Right now the error class does not do it. So, here is what I see (and in initial test works) can be done:
>
>The error handler is instantiated with the following code:
>
>lcError = lcErrorObj + '.ErrorHandler(error(), sys(16), lineno())'
>
>
>So, I added the alias() to the above, as follows:
>
>lcError = lcErrorObj + '.ErrorHandler(error(), sys(16), lineno(), ALIAS())'
>
>
>Therefore, now the method ErrorHandler gets 4 parameters, the last of which is the alias()
>
>Anyone sees a potential problem with the above?
>
>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform