Exception Data Collection
Try
...code that might throw an exception...
Catch ex As Exception
ex.Data.Add("CustomerId", custId)
Throw New Exception("Failure in processing Customer", ex)
End Try
' or
Try
...code that might throw an exception...
Catch ex As Exception
Dim myEx As New Exception("Failure in processing Customer", ex)
myEx.Data.Add("PersonId", pers.FirstName)
Throw myEx
End Try
' retrieve
For Each key In ex.Data.Keys
Debug.Print(key & ": " & ex.Data(key))
Next