Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET 4 vb need help with error and better reporting to identify exact cause.

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
Using a try catch only gives a general error
I have 3 Stored procedures that run 1-2-3 highlighted in yellow
depending on which one fails I get the same error
How can I code this so I know which one of the 3 casue the error and then present a separate message depending on which one, so we can determine what is wrong in the database. These are caused someone did not keying in someones info. correctly. But Thats another issue.

Code:
...
       strResourceEmail = sp_[highlight #FCE94F]SOWGetResourceEmailFromePrizeID[/highlight](Session("ePrizeID"))
       strManagerTheName = sp_SOWGetMana[highlight #FCE94F][/highlight]gerNameFromResourceePrizeID(Session("ePrizeID"))
       strManagerLName = Trim(Left(strManagerTheName, InStr(1, strManagerTheName, ",") - 1))
       strManagerFName = Trim(Right(strManagerTheName, Len(strManagerTheName) - InStr(1, strManagerTheName, ",")))
       strManagerEmail = sp_[highlight #FCE94F]SOWGetManagerEmailFromManagerName[/highlight](strManagerLName, strManagerFName)

       Catch ex As Exception
               Dim ErrorTitle As String = "Error in ResourceAddtime.aspx.vb - btnSubmitWeek_Click"
                Dim PageName As String = System.IO.Path.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath)
                Dim Retval As String = ErrorTrap(PageName & " - " & System.Reflection.MethodBase.GetCurrentMethod().Name, ex.Message, ErrorTitle)
        Finally
...


DougP
 
The most simple way, (without refactoring to tidy up the code base), is to put each call in it's own unique method, with each method having a unique try...catch block, OR wrap each call to a unique procedure in its own try...catch block.



Rhys

"Technological progress is like an axe in the hands of a pathological criminal"
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe"
Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top