Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…addin into dev
  • Loading branch information
joyfullservice committed Jul 8, 2023
2 parents 1037448 + d322b17 commit 3d62401
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Version Control.accda.src/modules/modErrorHandling.bas
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Option Private Module
Option Explicit


Private Type udtThis
blnInError As Boolean ' Monitor error state
End Type
Private this As udtThis


'---------------------------------------------------------------------------------------
' Procedure : DebugMode
' Author : Adam Waller
Expand Down Expand Up @@ -39,11 +45,10 @@ End Function
'
Public Sub LogUnhandledErrors()

Static blnInError As Boolean
Dim blnBreak As Boolean

' Check for any unhandled errors
If (Err.Number <> 0) And Not blnInError Then
If (Err.Number <> 0) And Not this.blnInError Then

' Don't reference the property this till we have loaded the options.
If OptionsLoaded Then blnBreak = Options.BreakOnError
Expand Down Expand Up @@ -78,11 +83,11 @@ Public Sub LogUnhandledErrors()
' Log otherwise unhandled error
If Not Log(False) Is Nothing Then
' Set flag so we don't create a loop while logging the error
blnInError = True
this.blnInError = True
' We don't know the procedure that it originated from, but we should at least
' log that the error occurred. A review of the log file may help identify the source.
Log.Error eelError, "Unhandled error, likely before `On Error` directive", "Unknown"
blnInError = False
this.blnInError = False
End If
End If
End If
Expand Down Expand Up @@ -120,7 +125,11 @@ End Function
Public Function CatchAny(eLevel As eErrorLevel, strDescription As String, Optional strSource As String, _
Optional blnLogError As Boolean = True, Optional blnClearError As Boolean = True) As Boolean
If Err Then
If blnLogError Then Log.Error eLevel, strDescription, strSource
If blnLogError Then
this.blnInError = True
Log.Error eLevel, strDescription, strSource
this.blnInError = False
End If
If blnClearError Then Err.Clear
CatchAny = True
End If
Expand Down

0 comments on commit 3d62401

Please sign in to comment.