Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3614114
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:12:29+00:00 2026-05-18T22:12:29+00:00

Sometimes I do this and I’ve seen others doing it too: VB: Try DontWannaCatchIt()

  • 0

Sometimes I do this and I’ve seen others doing it too:

VB:

Try
    DontWannaCatchIt()
Catch
End Try

C#:

try 
{ 
    DontWannaCatchIt();
} 
catch {}

I know I should catch every important exception that I’m expecting and do something about it, but sometimes it’s not important to – or am I doing something wrong?

Is this usage of the try block incorrect, and the requirement of at least one catch or finally block an indication of it?

Update:

Now I understand the reason for this, and it’s that I should at least comment on the empty catch block so others understand why it’s empty. I should also catch only the exceptions I’m expecting.

Luckily for me I’m coding in VB so I can write it in just one catch:

Catch ex As Exception When TypeOf ex Is IOException _
                    OrElse TypeOf ex Is ArgumentException _
                    OrElse TypeOf ex Is NotSupportedException _
                    OrElse TypeOf ex Is SecurityException _
                    OrElse TypeOf ex Is UnauthorizedAccessException
    'I don't actually care.
End Try
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:12:29+00:00Added an answer on May 18, 2026 at 10:12 pm

    If you don’t want to catch it, why are you using try in the first place?

    A try statement means that you believe something can go wrong, and the catch says that you can adequately handle that which goes wrong.

    So in your estimation:

    try
    {
        //Something that can go wrong
    }
    catch
    {
        //An empty catch means I can handle whatever goes wrong. If a meteorite hits the
        //datacenter, I can handle it.
    }
    

    That catch swallows any exceptions that happen. Are you that confident in your code that you can handle anything that goes wrong gracefully?

    The best thing to do (for both yours and your maintenance programmer’s sanity) is to explicitly state that which you can handle gracefully:

    try
    {
        //Something that could throw MeteoriteHitDatacenterException
    }
    catch (MeteoriteHitDatacenterException ex)
    {
        //Please log when you're just catching something. Especially if the catch statement has side effects. Trust me.
        ErrorLog.Log(ex, "Just logging so that I have something to check later on if this happens.")
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes Eclipse comes up saying hey you should debug this line!!! but doesn't actually
I have a few GridItem components that gets filled with dynamic data. Sometimes this
When reviewing, I sometimes encounter this kind of loop: i = begin while (
When is it a good idea to use PHP_EOL ? I sometimes see this
This may sound strange but sometimes when your ASP.NET webapp isn't working and you
Sometimes I get a broken background in Chrome. I do not get this error
This is what I have so far: myArray.map!{ rand(max) } Obviously, however, sometimes the
In code, I sometimes see people specify constants in hex format like this: const
I have a DLL with some COM objects . Sometimes, this objects crashes and
So, from my experience, masterpages sometimes can lag when you do updates. This is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.