JasonNevin
Programmer
I have nearly finished developing my first ASP.NET application using VB.NET. The bit I'm now struggling with is finding a good way of handling errors. What I would like is a single procedure that handles all errors from the application. i.e I'd like to do the following ;
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dim strStage as string
Try
strStage = "Opening database"
...code...
Catch ex as Exception
HandleError(ex,strStage)
end try
I'd also like any called procedures to pass errors up to this level.
Is this possible? Is it good practice?
Any suggestions would be welcome. I've trawled the web but can only seem to find examples of error handling that is carried out in each procedure. Seems inefficient to me.
Thanks.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dim strStage as string
Try
strStage = "Opening database"
...code...
Catch ex as Exception
HandleError(ex,strStage)
end try
I'd also like any called procedures to pass errors up to this level.
Is this possible? Is it good practice?
Any suggestions would be welcome. I've trawled the web but can only seem to find examples of error handling that is carried out in each procedure. Seems inefficient to me.
Thanks.