This project is read-only.
1
Vote

Exception Handling - ExceptionManager Issue

description

I’m a beginner in using Enterprise Library 6. I’m reading its documentation and trying to apply it in a small demo project but I end up with a problem I couldn’t understand it or figure out how to solve it. I have used the configuration tools to configure the required blocks.

The problem occurred when the following line of the code executed:
Try
            oOrganization.Load(1)

            With oOrganization
                .OrganizationName = "Aljafar 101010"
                .OrganizationParentId = 0

                .Save(errorsList, 1)
            End With
            MsgBox("Completed")

        Catch tex As TechnicalException
            'Dim exManager As ExceptionManager = EnterpriseLibraryContainer.Current.GetInstance(Of ExceptionManager)()
            'ExceptionPolicy.SetExceptionManager(exManager)

            ExceptionPolicy.HandleException(tex, "Default")
            MsgBox(tex.UserMessage)
        Catch bex As BusinessException
            MsgBox(bex.Message)

        Catch ex As Exception
            ExceptionPolicy.HandleException(ex, "Default")
            MsgBox(ex.Message)

        End Try
The error message is “Must set an ExceptionManager in the ExceptionPolicy class using the SetExceptionManager method”.

Please I need your help.

Kind regards.

file attachments

comments