Exception handling suggestions

  • Thread starter Thread starter Zytan
  • Start date Start date
It seems verbose to write
out three handlers that all do the same thing. So, I could just catchException. But, is that recommended? It'll catch everything, even
out of memory exceptions.

http://blogs.msdn.com/brada/archive/2005/03/04/385531.aspx
Effective .NET Framework based development: Exception handing and
Memory Management

Brad Abrams states:

"catch (Exception e) is your friend

Myth: Catching Exception is evil
This is motivated by a desire to avoid catching low level exceptions
such as OutOfMemoryException, and StackOverflowException

Do catch every exception you should handle

Don't attempt to catch every exception a method could throw
Its ugly, version brittle, and difficult to test

Catch what you need to handle, let the rest pass"

Zytan
 
on error goto worked better in my opinion

I mean; using a simple select case statement; you could trap RANGES of
errors

this isn't possible using .NET


'yeah lets just identify every possible error and write it out by
hand'

what a stupid language

LONG LIVE VB6; it's still more popular than VB.net _AND_ C# combined!~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top