Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. This probably falls into the 'weird' category

This probably falls into the 'weird' category

Scheduled Pinned Locked Moved The Weird and The Wonderful
questionhelp
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I am busy removing empty catch blocks from a project I have inherited (Yes, the same one as before, made by the same criminal. You can tell by those great 'Denglish' variable names). Now I have found a catch block that's not empty. Finally. And what is done to handle the error? This:

    try
    {
    MessageBox.Show(String.Format(tt.Readwert("t3"), Konstanten.Ftpprogdir), tt.Readwert("t2"),
    MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
    }
    catch
    {
    MessageBox.Show("Programmverzeichnis fehlt", tt.Readwert("t2"),
    MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
    }

    Edit: "Programmverzeichnis fehlt" means 'the program directory is missing'. How can that be when the program is obviously running when it hits those code lines? And how does he conclude that by having failed to open a MessageBox? This tt.Readwert-nonsense does not check any directories. It's just his own shot at localizing strings. Edit^´2: And let's not forget that the error message in case of an exception will obviously not be localized :)

    At least artificial intelligence already is superior to natural stupidity

    L 1 Reply Last reply
    0
    • L Lost User

      I am busy removing empty catch blocks from a project I have inherited (Yes, the same one as before, made by the same criminal. You can tell by those great 'Denglish' variable names). Now I have found a catch block that's not empty. Finally. And what is done to handle the error? This:

      try
      {
      MessageBox.Show(String.Format(tt.Readwert("t3"), Konstanten.Ftpprogdir), tt.Readwert("t2"),
      MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
      }
      catch
      {
      MessageBox.Show("Programmverzeichnis fehlt", tt.Readwert("t2"),
      MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
      }

      Edit: "Programmverzeichnis fehlt" means 'the program directory is missing'. How can that be when the program is obviously running when it hits those code lines? And how does he conclude that by having failed to open a MessageBox? This tt.Readwert-nonsense does not check any directories. It's just his own shot at localizing strings. Edit^´2: And let's not forget that the error message in case of an exception will obviously not be localized :)

      At least artificial intelligence already is superior to natural stupidity

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      looks like some copy/paste error to me. Wouldn't surprise me if you do a quick search on "Programmverzeichnis fehlt", you will find that more often. But yea, this looks like some bad error handling.

      Y 1 Reply Last reply
      0
      • L Lost User

        looks like some copy/paste error to me. Wouldn't surprise me if you do a quick search on "Programmverzeichnis fehlt", you will find that more often. But yea, this looks like some bad error handling.

        Y Offline
        Y Offline
        Yehuda Katz
        wrote on last edited by
        #3

        I think it actually makes sense (even if it is not the correct way to do it). I bet that the programmer expected that something in the

        Konstanten.Ftpprogdir

        property could throw an exception.

        L 1 Reply Last reply
        0
        • Y Yehuda Katz

          I think it actually makes sense (even if it is not the correct way to do it). I bet that the programmer expected that something in the

          Konstanten.Ftpprogdir

          property could throw an exception.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hey, you can read his twisted mind! Would you please come over and help me with making sense of the rest of this mess? You are right. He tries to tell us that the application directory is not there. The program runs on a mobile device and tries to get the latest version of itself when the device is docked. My friend here just could not figure out how a program that is currently running can update itself. Now, how can it possibly happen that the application directory is not there when the application itself is obviously running at that moment? He is trying to prevent an impossible error. He is like the coyote when he builds another roadrunner trap. Everybody but him can see how it is going to end. And when it explodes in his face, he can't figure out why. Instead he simply wraps the problematic code in a 'try' and leaves the catch block empty. Nothing has happened, let's just go on with it. This time he at least tried to show some error message, but of course not without making a mess out of that simple task. I have written it before: Tar him, feather him, throw him out of the guild and then chase him out of town.

          At least artificial intelligence already is superior to natural stupidity

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups