locked
What are the best practices for exception handling in n-tier applications? RRS feed

  • Question

  • What are the best practices for exception handling in n-tier applications?

    The application is a fat client based on MVVM pattern with .NET framework.

    Sunday, April 5, 2015 2:45 AM

Answers

  • The only advice I can give is that the exception and overall error handling should be taken care at the design level, and not at the implementation level. Making sure that at least a proper framework is at place for error-handling is important. Adding exception code later, most probably will need the design change and hence many changes in the code than expected.
    • Marked as answer by techhub1337 Monday, April 6, 2015 2:34 PM
    Monday, April 6, 2015 12:13 AM

All replies

  • Evert tier should have an exception handler and a method to return an error condition to the parent tier.  When an exception occurs you should stop processing because you have invalid data.

    You should attempt to prevent common exceptions before they happen like test for null object and normal out of range conditions.


    jdweng

    • Proposed as answer by Cor Ligthert Sunday, April 5, 2015 8:49 AM
    Sunday, April 5, 2015 8:35 AM
  • What are the best practices for exception handling in n-tier applications?

    The application is a fat client based on MVVM pattern with .NET framework.

    That would be to catch all exceptions at a single point in the n-tier solution, log it and create user friendly messages displayed to the user. 
    Sunday, April 5, 2015 9:56 AM
  • The only advice I can give is that the exception and overall error handling should be taken care at the design level, and not at the implementation level. Making sure that at least a proper framework is at place for error-handling is important. Adding exception code later, most probably will need the design change and hence many changes in the code than expected.
    • Marked as answer by techhub1337 Monday, April 6, 2015 2:34 PM
    Monday, April 6, 2015 12:13 AM