Results 1 to 7 of 7

Thread: Detailed Exception Handling Resources?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Detailed Exception Handling Resources?

    Does anyone know of any good, detailed resources or books for best-practices on exception handling? I am looking to dive into a much deeper understanding of it, and am finding it hard. All the books I see over .NET, ASP.NET, etc. place little emphasis or detail on exception handling.

    I am currently testing out a 3-tier ASP.NET application, with a presentation layer, business logic layer, and data layer, and want to know more about exactly when to throw errors, when to catch them, what layer to do them in, etc.

    I don't want a simple google search on ".NET exception handling" and then having you post the first couple of links. I would like you to respond if you have quality, known resources that you have used or have found.

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Detailed Exception Handling Resources?

    I dont know if this will be as in depth as you want but it contains lots of "best practice" advice and general tips on exception handling/throwing (as well as loads more): http://www.amazon.com/Framework-Desi...081603-6222806
    I've not read the entire Exception Handling chapter yet but I don't think it goes in to anything about where/when to throw excpetions in N-Tier apps though.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Detailed Exception Handling Resources?

    That is a decent resource for when you are building APIs, but it is still only one small chapter on going over exceptions. I still haven't found a good resource that goes over exactly what layer I should actually catch/throw different types of errors in an N-tier app.

  4. #4

    Re: Detailed Exception Handling Resources?

    That depends on where you think your exceptions are going to be thrown. Should you derive your own custom exceptions for them? If one call fails, should you throw an exception or modify another variable that affects the system down the line. If you look at the framework, it has all types of exceptions that can get thrown depending on what happens.

    I guess it's a matter of opinion where you feel an exception could be raised. It's like the butterfly effect almost.

  5. #5
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Detailed Exception Handling Resources?

    Quote Originally Posted by gigemboy View Post
    That is a decent resource for when you are building APIs, but it is still only one small chapter on going over exceptions. I still haven't found a good resource that goes over exactly what layer I should actually catch/throw different types of errors in an N-tier app.
    To be honest I think that small chapter (roughly 40 pages) and MSDN are the best you are going to get... I dont really understand what you are expecting to find though - I dont think you will find a guide that is as specific as telling you where to throw which type of exceptions in an N-Tier app. As formlesstree says, its up to you to decide which exceptions get thrown where based on what you want to happen.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Detailed Exception Handling Resources?

    Well I guess I just don't know exactly when to throw and when to catch. Way down in the data layer, say I have a dataadapter.Fill method that I know could error out if a connection can't be made. Do I catch the error in the data layer? Do I throw it? Or do I not do anything and just allow it to happen and have the error caught in a try/catch block on the initial method call all the way up in the presentation layer? These types of questions are what I can't quite get my head around.

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Detailed Exception Handling Resources?

    Depends on your architecture... we do our error handling some where in the middle... sort of... DA errors get caught in our remote objects, logged... transactions rolled back... and then the error is re-thrown, so that it crosses back to the client side, where we can display it to the user. So our error handling is done in the public method that we access via remoting, and not in the DA itself.

    Other conventional wisdom says to handle it at the lowest, most direct way possible... of an sproc can error out, wrap that in a try-catch... which is at odds with what we're doing... for us, the lowest possible point is the transaction on the server.... so maybe we're not so far off from that.

    Anywho, that's my two centavos.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width