Andy
Andy

Reputation: 429

Exception in one DNN module prevents processing all other modules on page

I have very general problem on DNN 6.0 web site that I am working on: unhanded exception in one DNN module affects processing all other modules on page. Example:

Let's say I have DNN page with two modules on it. Module1 has button which onclick event handler throws exception. Module2 has just some label text.

So when user press Module1.button we see an error instead of Module1 and Module2 is not visible.

Is it possible to catch all such Module1 exceptions in one place and let DNN process other modules on page? (I know that easiest/simplest way is to write try/catch block in button.onclick but I can't implement such approach in all modules that we created because it would take to much time. )

Upvotes: 3

Views: 676

Answers (1)

Brian Webster
Brian Webster

Reputation: 30855

You suggested the correct answer.

Implement try/catch blocks and utilize the following functions

  • LogException() - logs error, does not halt the module from loading
  • ProcessModuleLoadException() - logs error, halts the module from loading

Example code for this:

try
{
    //BLAH
}
catch (Exception exc) //Module failed to load
{
    Exceptions.ProcessModuleLoadException(this, exc);
}

Upvotes: 5

Related Questions