Exception handling policy in libraries

Posted by Asaf R on Stack Overflow See other posts from Stack Overflow or by Asaf R
Published on 2010-05-04T12:08:07Z Indexed on 2010/05/04 12:18 UTC
Read the original article Hit count: 575

Filed under:
|
|
|

When building a .NET library, what's your exception handling policy? In specific, what's your policy about handling exceptions inside library calls and exposing them to calling code?

  • Would you treat a library function as any other, thus letting all exceptions it can't handle flow out of it as-is?
  • Would you create a custom exception for that library?
  • Would you catch all exceptions and throw the library's exception instead? Would you set the original exception as the library's exception internal exception?
  • How would the library dependence on a DB affect your exception-handling policy?
  • What other guidelines and rules would you suggest?

© Stack Overflow or respective owner

Related posts about exception-handling

Related posts about exception