Forum:  Bugs & Issues

Thread:  Trap Error after calling Entity.Save


Dan1 (User)   Posted on: 03-Oct-2007 22:03:57.
I'm trying to trap an error in a try and catch. I am getting an error (Unique Key Violation) on the following method in my entity class.

Protected Overrides Overloads Function UpdateEntity() As Boolean
            Dim dao As WeldSpec_SpotDAO = CType(CreateDAOInstance(), WeldSpec_SpotDAO)
            Return dao.UpdateExisting(MyBase.Fields, MyBase.Transaction)
        End Function


This error occurs after I call the .Save method on an instance of the entity. I have wrapped the .Save in a try/catch but it does not catch it.

        Try
            x.Save()
        Catch ex As Exception
            MsgBox("Exception")

        End Try

Am I missing something here? Seems pretty basic, but I am not sure how to trap this.
daelmo (Support Team)   Posted on: 04-Oct-2007 02:35:29.
Hi Dan,

Did the error throws at your method UpdateEntity() ? At what line exactly the error ocurrs? This often results in a scope-thing... Could you thing more elaborate code to show where are you traping the exception?

Regards,