Skip to content

Evaluating an Errorblock in an Error handler causes an error #77

@alexstrickland

Description

@alexstrickland

In the program below if the debugging code is linked in then the current error handler is called recursively until it crashes.


procedure Main()

    local bOldErrorBlock
    local n

    setMode(24, 80)
    if hb_isFunction("__DebugItem")
        ? "Debugger linked in"
    endif

    bOldErrorBlock := ErrorBlock({ |e| HandleError(e, bOldErrorBlock, .t.) })
    begin sequence
        n++
    recover
        ? "Recovered"
    end sequence

    ErrorBlock({ |e| HandleError(e, bOldErrorBlock, .f.) })
    begin sequence
        n++
    recover
        ? "Recovered"
    end sequence
    ErrorBlock(bOldErrorBlock)

return
    
function HandleError(e, bOldErrorBlock, lCarryOn)

    ? "HandleError " + hb_ValToStr(lCarryOn)
    if lCarryOn
        break
    endif

return eval(bOldErrorBlock, e)    

I love your addin! Thanks, Alex.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions