Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Exception handling in BLLException handling in BLL
Previous
 
Next
New Post
1/31/2009 7:57 AM
 

In the presentation layer there are lots of examples of exception handling using:

Try

..something..

        Catch exc As Exception
            ProcessModuleLoadException(Me, exc)
        End Try

In your controller or info modules there is no control visible (you can't pass Me). I'd like to wrap all my import/export and iHydratable fills with exception hadling and would like recommendations on the best logging overlay to use. I could just do LogException(exc) but that doesn't bubble up an error to the user. I want to log an exception for debugging and diagnosic purposes, as well as give some sort of informative error to the user that something went wrong. I'd like to do that in a way that follows the DNN model, but after looking at the source for some of the core modules (HTML, Events, DOcuments) I don't see much error handling at all in those at that layer.

 

 
New Post
1/31/2009 11:18 AM
 

Hi Keith,

I (and many others) strongly discourage catching the general exception class at any level -- this anti-pattern actually makes debugging more difficult.  One exception to this rule (that some argue for) is a top-level exception handler that logs the relevant data and (in a web-application context) displays a message to an end-user.  Obviously DotNetNuke diverges from this standard throughout its code, but I would wager that many on the core team would agree that this is something that should be addressed at some point in the future (I, of course, could be mistaken on this point).  Google for lots more interesting discussion.

That said, if you insist on catching exceptions that the current method has no way of handling, please consider just re-throwing the exception after logging it.  Something along the lines of:

Try
     ...
Catch ex As System.IO.IOException
    LogException(ex)
    Throw
End Try

Note that I've selected a more-specific exception than the base System.Exception class above.  Hope this gets you started!

Brandon


Brandon Haynes
BrandonHaynes.org
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Exception handling in BLLException handling in BLL


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out