DotNetNuke error reporting requires improvement

I found that DotNetNuke code often doesn't report exceptions to user, but hides them.This style of error handling is natural for VB developers, who had the favorite comand “on error resume next”.(I hope that DNN developers are from different school).

 In some cases, exception are written it to EventLog table, but it is not always easy to access. E.g. if errors are occured during install and portal is not created yet, View log Web UI obviously is not available.

I've posted the suggestion to DNN support.
Below I listed places where I've added exception reporting. I am going to add more as far I will find reporting missing, but useful for my debugging.

In Upgrade.InstallDNN

                'After Parse the script nodes

              If Len(strExceptions) > 0 Then 'mnF 12/4/2006

                    HtmlUtils.WriteFeedback(HttpContext.Current.Response, 0, "Exceptions were reported to Default Data Provider log file")

                    strExceptions = "" 'reset

                End If

  'And After installMemberRole

                If Len(strExceptions) > 0 Then 'mnF 12/4/2006

                    HtmlUtils.WriteFeedback(HttpContext.Current.Response, 0, strExceptions)

                    strExceptions = "" 'reset

                End If

 

In Library\Components\Portal\PortalController.vb AddPortalInfo

In catch added Trace exception

 

 

In DNNLibrary\Components\Providers\Logging\Exception Logging\ExceptionLogController.vb

  Sub AddLog(ByVal objException As Exception, ByVal LogType As ExceptionLogType)

            Trace.WriteLine("DotNetNuke.Services.Log.EventLog.ExceptionLogController.AddLog: " & LogType.ToString() & " - " & objException.ToString())

 

In DNNLibrary\Components\Upgrade\Upgrade.vb

'InstallMemberRoleProvider should save to log any exceptions (if any) in the same way as Upgrade.ExecuteScript does

            If Len(strExceptions) > 0 Then 'mnf 13/4/2006

                FSHelperLib.StreamHelper.SaveStringToFile(strExceptions, strProviderPath & "InstallMemberRoleProvider.log")

            End If

 

In DNNLibrary\Components\Users\UserController.vb

Function AddUser

                If Status = UserRegistrationStatus.AddUser Then

'Existing code removed for brevity

                Else 'mnf 13/4/2006

                    If UserId < 0 Then 'TODO may be throw exception

                        Trace.WriteLine("Unable to AddUser " & objUser.Membership.Username & " - " & Status.ToString())

                    End If

                End If

 

 Function DeleteAllUsers

Catch exc As Exception
                Trace.WriteLine(exc.ToString())

\Install\Install.aspx.vb Function InstallApplication

'After backing up old web.config
                Catch ex As Exception
                    'Error backing up old web.config
                    'This error is not critical, so can be ignored
                    System.Diagnostics.Trace.WriteLine("InstallApplication " & backupFolder & "web_old.config" & " error " & ex.ToString()) 
                End Try

DNNLibrary\Components\Security\Roles\RoleController.vb AddUserRole
                Try
                    AspNetSecurity.Roles.AddUserToRole(objUser.Membership.Username, objUserRole.RoleName)
                Finally 'instead of Catch ex As Exception
                   
'Reset the Application Name
    
                    
Common.Globals.SetApplicationName(originalAppName)
                End Try

DNNLibrary\Components\Tabs\TabController.vb Function GetTab

            Try

                Return FillTabInfo(dr)

            Catch exc As Exception

                System.Diagnostics.Trace.WriteLine("Components\Tabs\TabController.vb GetTab " & TabId & " error " & exc.ToString())

            Finally

                If Not dr Is Nothing Then

                    dr.Close()

                End If

            End Try

            Return Nothing

DNNLibrary\Components\Skins\Skin.vb in Page_Init

                Dim arrModuleControls As ArrayList = objModuleControls.GetModuleControlsByKey(Key, objModule.ModuleDefID)

                If arrModuleControls.Count = 0 Then

                    System.Diagnostics.Trace.WriteLine("DotNetNuke.UI.Skins.Skin.Page_Init GetModuleControlsByKey returned 0 controls for key " & Key)

                End If

DNNLibrary\Controls\DotNetNuke.WebUtility\ClientAPI.vb GetClientAPICapsDOM

Try

                    strFileName = System.Web.HttpContext.Current.Server.MapPath(ScriptPath & "/ClientAPICaps.config")

                Catch ex As Exception

                    System.Diagnostics.Trace.WriteLine("DotNetNuke.UI.Utilities.ClientAPIs.GetClientAPICapsDOM " & ex.ToString())

                    'ignore error - worried about people with reverse proxies and such...

                End Try

NEW for DNN 4.4.
Library\Providers\MembershipProviders\AspNetMembershipProvider\AspNetMembershipProvider.vb  CreateUser

Catch exc As Exception ' an unexpected error occurred

LogException(exc)  ' WHY it is COMMENTED?????????

createStatus = UserCreateStatus.UnexpectedError

End Try

NEW for DNN 4.4.
admin\Security\SendPassword.ascx.vb  cmdSendPassword_Click

                            Try

                                objUser.Membership.Password = UserController.GetPassword(objUser, txtAnswer.Text)

                            Catch ex As Exception

'Actual exception should be logged

                                canSend = False

                                strMessage = Localization.GetString("PasswordRetrievalError", Me.LocalResourceFile)

                            End Try

AND

                              Try

                                Mail.SendMail(objUser, MessageType.PasswordReminder, PortalSettings)

                                strMessage = Localization.GetString("PasswordSent", Me.LocalResourceFile)

                            Catch ex As Exception

'Actual exception should be logged

                                canSend = False

                            End Try

C:\Projects\FuncSoln\DNNLibrary\Components\Framework\PageBase.vb PageCulture
Try
preferredLocale = HttpContext.Current.Request("language")

...code is omitted

Catch
'Actual exception should be logged
End Try


 

posted @ Wednesday, April 26, 2006 9:06 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)

 
 
 
 
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789