By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

Does the Visual Studio's Help Index list all Exceptions?

P: n/a
I learned about Exceptions in School, and now that I'm building my
first real application on the job, I'm going through it trying to
analyze it for all possible Exceptions so I can handle them
effectively. I've been looking in the Help / Index for each Method's
documentation, and looking at the listed Exceptions. I'm finding a
number of methods with no Exceptions specified. Does that mean there
is no possible Exception for that method? Can I count on the
documentation in that way?

Like OleDbCommand.ExecuteReader. I'm using an Access database and
when I do a query that returns the resultset. No Exception is
listed. That method never throws an Exception???

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Felecha

The documentation lists all exceptions thrown by the runtime.

For an exhaustive list look up exception, you will see this is subclassed by
SystemException, which is what the runtime uses as a base class for all its
exceptions and ApplicationException which the class you should inherit from
if you wish to create custom exceptions in your own applications.

With respect to OleDbCommand.ExecuteReader this does throw an exception
InvalidOperationException.
However more generally you will seek to catch the OleDbException thrown from
the datasource (Access2000).

In this case it is not the method but the Jet engine that is throwing the
exception hence the reason why you do not see it listed under
..ExecuteReader.

OleDbException inherits from InterOpServices.ExternalException which
inherits from SystemException.
If you need access to the HResult thrown by the Jet engine, check out the
ErrorCode property of the OleDbException.

You should also note that when you move up to SqlServer, OleDbException is
replaced by SqlException, which is governed by the same philosophy as
OleDbException, except that it is SqlServer specific.

Additionally just because a method doesn;t list an exception as being thrown
does not mean that by using that method no exceptional conditions can occur
that cause it's code to break. It just means the framework does not
explicity throw an exception when that given exception occurs.

This is a subtle but important difference.

Just as when you write code, you may expect a certain condition to be true
and if it is not, you may decide to throw an exception. However if an
exceptional condition occurs that you didn;t think about before releasing
your code library/app, then your code will still automatically throw an
exception, it's just that you personally have not explicitly thrown that
error and therefore it will not be documented in your help files. The same
is true for Microsofts code and docs for .Net.

If you do something really stupid with a method it will throw an exception
and if this hasn't been accounted for by the framework developers, then it
wont be documented.

hth
Richard

"felecha" <fe*******@yahoo-dot-com.no-spam.invalid> wrote in message
news:40**********@Usenet.com...
I learned about Exceptions in School, and now that I'm building my
first real application on the job, I'm going through it trying to
analyze it for all possible Exceptions so I can handle them
effectively. I've been looking in the Help / Index for each Method's
documentation, and looking at the listed Exceptions. I'm finding a
number of methods with no Exceptions specified. Does that mean there
is no possible Exception for that method? Can I count on the
documentation in that way?

Like OleDbCommand.ExecuteReader. I'm using an Access database and
when I do a query that returns the resultset. No Exception is
listed. That method never throws an Exception???

Nov 20 '05 #2

P: n/a
Thanks. I've read your reply carefully and am trying to digest it.
Every point is applicable and I need to think about it, I can see.

Thanks a lot

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.