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?
For example,
- 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 guidelines and rules would you suggest for exception-handling in a .NET library?