Page 1 of 1

error handler acting odd

Posted: Mon Jul 20, 2020 10:00 pm
by don lowenstein
My error handler seems to be odd.
this just recently began.
It's not staying set on my default handler.

Is there a way to view the current error handler's target function it is currently set to?

Windows 10
MS-Visual C++ version 19
Harbour 3.2.0
FWH1095

the only thing different in my environment is a recent Windows Update.

Re: error handler acting odd

Posted: Tue Jul 21, 2020 3:51 am
by Antonio Linares
Don,

Harbour uses function ErrorBlock( bNewErrorBlock ) --> bPreviousErrorBlock to set/retrieve the errorblock.
As it uses a codeBlock as the param there is no way to retrieve the used function from the codeBlock.

Anyhow, you can use the function __vmItemId( codeBlock ) to check the codeblock unique ID:

Code: Select all

function Main()

   local bErrorBlock := { || nil }
   
   ? __vmItemId( bErrorBlock )
   
   ? __vmItemId( ErrorBlock() )  // this one is different from bErrorBlock
   
return nil

Re: error handler acting odd

Posted: Tue Jul 21, 2020 4:13 am
by Antonio Linares
A simpler way is to compare the codeBlocks:

Code: Select all

function Main()

   local bErrorBlock := { || nil }
   
   ? bErrorBlock == ErrorBlock()
   
return nil

Re: error handler acting odd

Posted: Tue Jul 21, 2020 4:41 pm
by don lowenstein
I found my problem thanks to your help, Antonio.

I trust all is well with you and wishing you the best.

Thank you.
Don