Skip to content
This repository has been archived by the owner on May 8, 2019. It is now read-only.

Commit

Permalink
Catch InvalidOperationException
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Jun 1, 2018
1 parent 7cf3099 commit 481083a
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions TsinghuaNet/Program.vb
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,49 @@ Module Program
Return 0
End Function
Public Async Sub WriteLog(message As String)
Dim task As Task
SyncLock Lock
task = Log.WriteLogAsync(message)
End SyncLock
Await task
Try
Dim task As Task
SyncLock Lock
task = Log.WriteLogAsync(message)
End SyncLock
Await task
Catch ex As InvalidOperationException
End Try
End Sub
Public Async Sub WriteException(ex As Exception)
Dim task As Task
SyncLock Lock
Public Async Sub WriteException(exception As Exception)
Try
Dim task As Task
SyncLock Lock
#If DEBUG Then
task = Log.WriteFullExceptionAsync(ex)
task = Log.WriteFullExceptionAsync(exception)
#Else
task = Log.WriteExceptionAsync(ex)
task = Log.WriteExceptionAsync(exception)
#End If
End SyncLock
Await task
End SyncLock
Await task
Catch ex As InvalidOperationException
End Try
End Sub
Public Async Sub WriteEvent(name As String)
Dim task As Task
SyncLock Lock
task = Log.WriteEventAsync(name)
End SyncLock
Await task
Try
Dim task As Task
SyncLock Lock
task = Log.WriteEventAsync(name)
End SyncLock
Await task
Catch ex As InvalidOperationException
End Try
End Sub
#If Debug Then
#If DEBUG Then
Public Async Sub WriteDebug(message As String)
Dim task As Task
SyncLock Lock
task = Log.WriteDebugAsync(message)
End SyncLock
Await task
Try
Dim task As Task
SyncLock Lock
task = Log.WriteDebugAsync(message)
End SyncLock
Await task
Catch ex As InvalidOperationException
End Try
End Sub
#End If
Friend Sub ShowError(message As String)
Expand Down

0 comments on commit 481083a

Please sign in to comment.