Last active
December 2, 2017 14:42
-
-
Save birksy89/60c594032bb69b99213f1ce431d3392c to your computer and use it in GitHub Desktop.
How to Log an Exception In Dotnetnuke (DNN)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Andrew.Modules.xxx.Models; | |
using DotNetNuke.Common.Utilities; | |
using DotNetNuke.Entities.Modules; | |
using DotNetNuke.Services.Exceptions; | |
using System; | |
using System.IO; | |
using System.Net; | |
namespace Andrew.Modules.xxx.Components | |
{ | |
public class myClassName : PortalModuleBase | |
//Must Inherit PortalModuleBase to use "this" in exception | |
{ | |
public void myMethod() | |
{ | |
try | |
{ | |
//Do some stuff | |
} | |
catch (Exception ex) | |
{ | |
//Create Proper Exception | |
Exceptions.ProcessModuleLoadException(this, ex,true); | |
//Create Human Readable Alert - Highlighting Who Failed | |
var objEventLog = new EventLogController(); | |
string logTitle = "Error!"; | |
string logMsg = $"Couldn't proccess {email}"; | |
objEventLog.AddLog(logTitle, logMsg, EventLogController.EventLogType.HOST_ALERT); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment