xsharp.eu • Subclassing Error
Page 1 of 1

Subclassing Error

Posted: Mon Feb 20, 2023 11:41 am
by stefan.ungemach
Does anyone have an idea why even a very simple instantiation of an Error subclass crashes in my code?

class ADSError inherit Error
method @@Throw() as void pascal
local oCB as Codeblock
safedebout32( self:SubCode, self:FuncSym, self:CallFuncSym )
if !empty( errorblock() ) // ACCEPT22 nur TEST auf Errorblock
oCB := suspenderrorhandler(NULL_CODEBLOCK)
begin sequence
super:@@Throw()
recover
end sequence
reseterrorhandler( oCB )
endif
oCB := NULL_CODEBLOCK
return
END CLASS
function ADSErrorBildenAusFehlercode(dwErrorCode as dWord, cFunc as string, cCallFunc as string, cExtraInfo := "" as string) as ADSError pascal

local oError as ADSError
oError := ADSError{}

Subclassing Error

Posted: Mon Feb 20, 2023 12:30 pm
by Chris
Hi Stefan,

There's a lot of unknown things in the sample you posted, can you please a compilable sample showing the problem?
Also in which line does the crash happen? Isn't there an exception message shown?

.

Subclassing Error

Posted: Mon Feb 20, 2023 2:21 pm
by stefan.ungemach
I'm sorry, but it seems to be an error in my callstack. If I write a 5-Liner it works; looks like it does in my code as well but logs a misleading call stack on the debug console. Please close the case.