Remove try-catch from Button1/2_Click event handlers
Refactored Button1_Click and Button2_Click to eliminate local try-catch blocks, allowing exceptions to propagate. Cleaned up redundant code and improved clarity by moving variable declarations outside of the previous try blocks. Core logic remains unchanged.
This commit is contained in:
@@ -7,7 +7,6 @@ Imports GdPicture14
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports EnvelopeGenerator.Infrastructure
|
||||
Imports Microsoft.EntityFrameworkCore
|
||||
Imports System.Text
|
||||
Imports DigitalData.Core.Abstractions
|
||||
|
||||
Public Class frmFinalizePDF
|
||||
@@ -93,8 +92,6 @@ Public Class frmFinalizePDF
|
||||
End Function
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Try
|
||||
|
||||
Dim oTable = LoadAnnotationDataForEnvelope()
|
||||
Dim oJsonList = oTable.Rows.
|
||||
Cast(Of DataRow).
|
||||
@@ -110,22 +107,9 @@ Public Class frmFinalizePDF
|
||||
File.WriteAllBytes(oNewPath, oNewBuffer)
|
||||
|
||||
Process.Start(oNewPath)
|
||||
Catch ex As Exception
|
||||
Dim exMsg As StringBuilder = New StringBuilder(ex.Message).AppendLine()
|
||||
|
||||
Dim innerEx = ex.InnerException
|
||||
While (innerEx IsNot Nothing)
|
||||
exMsg.AppendLine(innerEx.Message)
|
||||
innerEx = innerEx.InnerException
|
||||
End While
|
||||
|
||||
MsgBox(exMsg.ToString(), MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
||||
Try
|
||||
Dim oTable = LoadAnnotationDataForEnvelope()
|
||||
Dim oJsonList = oTable.Rows.
|
||||
Cast(Of DataRow).
|
||||
@@ -139,10 +123,5 @@ Public Class frmFinalizePDF
|
||||
oJObject1.Merge(oJObject2)
|
||||
|
||||
txtResult.Text = oJObject1.ToString()
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user