Announcement

Collapse
No announcement yet.

Retaining error code inside function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retaining error code inside function

    I was under the impression that setting ERROR would retain it's value until a run-time error or ERRCLEAR was called. This seems not to be so. Can anybody explain why this works the way it does?

    Code:
    #compile exe
    
    
    function SetError(byval ErrorCode as long) as long
             error ErrorCode
             msgbox format$(err,"err = # INSIDE function")
    end function
    
    
    function pbmain as long
             SetError 10
             
             msgbox format$(err,"err = # OUTSIZE function")
    end function


    ------------------
    Cheers

  • #2
    Seems to me that error handling is local to a SUB or FUNCTION.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment

    Working...
    X