Approaches for Error Code/Message Management in .NET

Posted by WayneC on Stack Overflow See other posts from Stack Overflow or by WayneC
Published on 2010-03-06T07:07:54Z Indexed on 2010/03/08 12:51 UTC
Read the original article Hit count: 239

Looking for suggestions/best practices on managing error codes and messages in a multi-tiered applications. Specifically things like:

  1. Where should error codes be defined? Enum? Class?
  2. How are error messages or further details associated with the error codes? resource files? attributes on enum values, etc.?
  3. If you have a multi-tier application consisting of DAL, BLL, UI, and Common projects for example, should there be a single giant list of codes for all tiers, or are the codes extensible by project/tier?

Update: Important to mention that I can't rely solely on Exceptions and custom Exception types for error reporting, as some clients for this application will be via web services (SOAP & REST)

Any suggestions welcome!

© Stack Overflow or respective owner

Related posts about .NET

Related posts about exception-handling