Author: Yisman | Posted on: 11/8/2010 7:20:32 AM | Views : 280

hello fellows
i would very much like to capture certain dal/bll exceptions in my page_error code and turn them into validation errors
so they should show up in the validationsummary

this is the code im trying now Protected Overrides Sub OnError(ByVal e As EventArgs)
Dim ex = Server.GetLastError
If ex.GetType = (New ArgumentException).GetType Then
Dim validator = New CustomValidator
validator.IsValid = False
validator.ErrorMessage = CType(ex, ArgumentException).Message
Validators.Add(validator)
Else
MyBase.OnError(e)
End If
End Sub
End Class

the logic is simply to catch only exceptions of type ArgumentException, otherwise it should bubble up (to global.asax handling)
what hapens is that after this code block runs, the exception still exists in the system ...

Go to the complete details ...