User
User

Reputation: 3274

Undocumented Exceptions in Enterprise Library

I am using Enterprise Library's DAAB to access a database, both with ExecuteReader and ExecuteNonQuery. The problem is that these methods do not have exceptions thrown documented... How can I, then, know which exceptions should I catch?

Upvotes: 1

Views: 97

Answers (2)

Alex KeySmith
Alex KeySmith

Reputation: 17101

I agree with WebTurner, I'm guessing a good place to start would be which database your connecting to, so if an ms sql database I'm guessing a couple of (perhaps many) exceptions would be:

  • SqlException
  • InvalidOperationException

http://msdn.microsoft.com/en-us/library/9kcbe65k.aspx


EDIT:

I just came across this: How can I determine which exceptions can be thrown by a given method?

Which looks liek it uses reflection to help uncover a list of exceptions that are thrown.

Upvotes: 2

Stephen Turner
Stephen Turner

Reputation: 7314

The problem is that there are many exceptions that will be thrown at a lower level than the enterprise library, and it would be impossible for EL to document all of these.

I suggest you use the exception handling and logging blocks to catch and log all exceptions. You can then see which ones occur and adapt the configuration of the exception handler or add new code to handle the specific execptions.

Upvotes: 1

Related Questions