I have an ASP.NET page with lots of event handlers that look like this:
Private Sub btnNextEvent_Click(sender As Object, e As EventArgs) Handles btnNextEvent.Click
Try
NextRegistration()
Catch ex As Exception
lblError.Text = ex.Message
End Try
End Sub
That tiny try-except block is repeated in many (maybe a dozen) places.
Is there a way to define a page-wide "default" exception handler, so that I could say something like this?
Private Overrides Sub DefaultHanderIWishIHad(ex As Exception)
lblError.Text = ex.Message
End Sub
Private Sub btnNextEvent_Click(sender As Object, e As EventArgs) Handles btnNextEvent.Click
'no need to handle here, because the default handler is just fine...
NextRegistration()
End Sub