Is OnError unable to trap some kind of errors?

I have the following code:

'****************************************************************************
' LogMessage: Writes messages to a log file
'
Sub LogMessage

        OnError goto ErrorHandler
        Open File ApplicationDirectory$() + "MVMMapInfo.LOG" For Append As #5
        Print #5, CurDate() + " " + " " + Time(24) + " " + Message
        Close File #5             
        OnError Goto 0

        Exit Sub

ErrorHandler:             
        Close File #5             
        TempText = "Error in LogMessage: " & Err() & " " & Error$() & Message
        Print TempText
        Call LogDebug(TempText) 
        OnError goto 0
        Exit Sub

End Sub


However, my application occasionally crashes at the line after the OnError 
line, i.e.
Open File ApplicationDirectory$() + "MVMMapInfo.LOG" For Append As #5

The error is:

"Cannot access file MVMMapInfo.LOG"

Has anyone seen this happen before where the OnError trap is ignored (or at 
least I 
assume it is being ignored...)
I don't have the MVMMapInfo.LOG file open at the time the error occurs, though 
it is 
possible that the application might not have closed it properly at it's last 
attempt.

Thanks,

Dave
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to