Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Security audit result of my project showing error on
try
// code
catch
//rollback
//msg
end try

//--Report Shows an error on "End Try"
Error Message Is
The catch block at page.aspx.vb line 364 handles a broad swath of
exceptions, potentially trapping dissimilar issues or problems that should not be dealt with at this point in the program.

//Help Please//

What I have tried:

Im Try to remove "END TRY" but it shows error
Try

Catch

End try
is complete statement.
Posted
Updated 31-May-17 20:12pm

1 solution

When you use Catch on it's own, it catches every exception that is thrown (and discards all the information on what happened at the same time).
VB
Dim Top As Double = 5
Dim Bottom As Double = 0
Dim Result As Integer = 0
Try
	Result = Top / Bottom
Catch ex As System.OverflowException
	MessageBox("Attempt to divide by zero:" + ex.Message)
End Try
Restricts the Catch to just the exceptions you can do something about.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900