• Lefty Middlewright (unregistered) in reply to anon

    Can't tell if you're pretending to be a jerk or you really are. If you spent more than 1 second reading Wikipedia to settle a dispute pertaining to Game Boy on the Internet, you're too twisted to be worth listening to.

  • eric76 (unregistered) in reply to ais523
    ais523:
    Arguably, this is simply an attempt to document which exceptions can be thrown. (Java even has "syntactic sugar" for this, the "throws ..." next to a method prototype, which states that the method either generates, or continues to throw, exceptions of various types rather than handling them itself.) So the only large WTF I see here is that it was done with redundant code rather than with a comment.
    That's pretty much what I was thinking.

    It's also possible that the author may have had the intention of going back later and adding some code to handle exceptions later and so he left "stubs" for that purpose.

  • (cs) in reply to Lefty Middlewright
    Lefty Middlewright:
    Can't tell if you're pretending to be a jerk or you really are. If you spent more than 1 second reading Wikipedia to settle a dispute pertaining to Game Boy on the Internet, you're too twisted to be worth listening to.
    Haters gonna hate...
  • Mr. Jackson (unregistered) in reply to The Nerve
    The Nerve:
    So then I think this would be the fighting monkey pattern.

    THAT'S IT! I have had it with these monkey fighting code snippets on this Monday-Friday website!

  • Sylver (unregistered) in reply to anon
    anon:
    Sylver:
    Nice!

    Still, acording to Wikipedia, Pokemon came out in 96. If Kyle was 12 when he watched Pokemon, that would make him 26... maybe you're just getting old. ;)

    And if you'd read more than the first sentence of the Wikipedia article, you'd have seen that the Game Boy game came out in Japan in 1996, didn't make it to the US until 1998. However, he said it reminded him of watching Pokemon, not playing, and the show didn't hit the US till 1999. So if he was 12 in 1999 (which might actually be too old to have watched the show) then he's 23, and wet behind the ears.

    Yes, but why assume he lives in the US?

    Either way, 23 is old enough to get drunk on your lawn legally. That makes him old enough to be a full participant on TDWTF, especially if he codes while drunk.

  • Omnium gatherum (unregistered)

    Proposed title: When the Great Dao is Lost...

  • Kyle Z. (unregistered) in reply to Sylver
    Sylver:
    anon:
    Sylver:
    Nice!

    Still, acording to Wikipedia, Pokemon came out in 96. If Kyle was 12 when he watched Pokemon, that would make him 26... maybe you're just getting old. ;)

    And if you'd read more than the first sentence of the Wikipedia article, you'd have seen that the Game Boy game came out in Japan in 1996, didn't make it to the US until 1998. However, he said it reminded him of watching Pokemon, not playing, and the show didn't hit the US till 1999. So if he was 12 in 1999 (which might actually be too old to have watched the show) then he's 23, and wet behind the ears.

    Yes, but why assume he lives in the US?

    Either way, 23 is old enough to get drunk on your lawn legally. That makes him old enough to be a full participant on TDWTF, especially if he codes while drunk.

    You're right. I'm not from US.

    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see. And f**k it all. I'm not giving a shit, why you guys are?

    Also, the first "program" that I've made was a bot-programmation (C++ like) for an online game, and I was 12years old that time. (Yes, I was watching pokemon in that age.)

    Captcha: opto. I opto not to discuss this anymore. Back to WTF pls. :)

  • CIIWri3 (unregistered)

    TRWTF is a function that potentially throws so many exceptions.

    Captcha: eros -- shot from a bow

  • Poke-your-Mom (unregistered) in reply to anon
    anon:
    Sylver:
    Leo:
    Kyle Z.:
    LightStyx:
    IndexOutOfRangeException! I choose you! *throws exception* Use InnerException now!

    Hahaha nice post.. reminded of my childhood watching pokemon!

    Captcha: luptatum. maybe a new pokemon? now there's 7894798478974

    If you are young enough to have watched Pokemon in your childhood, you're too young to be worth listening to. Get off the Internet and go "text" or whatever it is you young people do these days. Come back when you were born earlier. ...

    Nice!

    Still, acording to Wikipedia, Pokemon came out in 96. If Kyle was 12 when he watched Pokemon, that would make him 26... maybe you're just getting old. ;)

    And if you'd read more than the first sentence of the Wikipedia article, you'd have seen that the Game Boy game came out in Japan in 1996, didn't make it to the US until 1998. However, he said it reminded him of watching Pokemon, not playing, and the show didn't hit the US till 1999. So if he was 12 in 1999 (which might actually be too old to have watched the show) then he's 23, and wet behind the ears.

    In middle school, in '97, we used Pokemon cartoons (and others) in our Japanese class. When it came out here, I was amused how "Pikachu: you are the distinct individual [whom] I have chosen!" was translated.

  • wtf (unregistered) in reply to Kyle Z.
    Kyle Z.:
    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see.

    Okay, now you're going over the line. Looney Tunes isn't "shit", Looney Tunes is the shit! (gotta get the originals, though. The sanitized versions are useless.)

  • CAPTCHA: similis (unregistered)

    Does C-pound have operator overloading? Could "Throw" potentially add something like the current method name to a list of methods visited by the Exception?

  • CoderDan (unregistered) in reply to *
    *:
    The Real WTF is that they didn't use BobX.
    <xbobfuncdef name="GetDAO">
      <xbobtry>
        <xbobfuncreturn>
          <xbobcall func="Activator.CreateInstance">
        <xbobendfuncreturn>
        <xbobcatch type="ArgumentNullException">
          <xbobthrow>
        <xbobendcatch>
        ...
        <xbobcatch type="TypeLoadException">
          <xbobthrow>
        <xbobendcatch>
      <xbobendtry>
    <xbobfuncenddef>
    

    +1

  • Brendan (unregistered) in reply to send me the codez

    No finally always runs, I think the feature Oneway is looking for is called a try-catch block.

  • Shirt Monkey (unregistered)

    Darn. thedailywtf-laginess is back.

  • Anonymous (unregistered) in reply to CIIWri3
    CIIWri3:
    TRWTF is a function that potentially throws so many exceptions.

    Captcha: eros -- shot from a bow

    A function should throw as many exceptions as required, one for each error state it has to deal with. There is nothing unusual about a function that throws a lot of exceptions; just consider something simple like File.Create(). Imagine how many potential exceptions there are from this one function - file read-only, file in use, user has no permissions, filename invalid, path invalid, path too long, etc. etc. If it has many different failure scenarios it will throw many different exceptions, there is nothing remotely unusual or wrong about this.

  • Anonymous (unregistered) in reply to CAPTCHA: similis
    CAPTCHA: similis:
    Does C-pound have operator overloading? Could "Throw" potentially add something like the current method name to a list of methods visited by the Exception?
    In short, no. Good thinking though.
  • anonymous (unregistered) in reply to Oneway
    Oneway:
    I would vote for introducing a new language function that would reexecute code that raised the error, but in a more 'forceful' way. Something like:

    try { //Mess up code here } catch (Exception $e) { // handle exception } try_harder { // execute again. }

    You mean like: try { //Mess up code here } catch (Exception $e) { try_harder { // execute again. catch (Exception $e) { // handle exception } }

  • (cs) in reply to Abdiel
    Abdiel:
    do || !do;

    if (false) try {}

    There is no try, only do.

  • (cs) in reply to wtf
    wtf:
    Kyle Z.:
    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see.

    Okay, now you're going over the line. Looney Tunes isn't "shit", Looney Tunes is the shit! (gotta get the originals, though. The sanitized versions are useless.)

    Oh sure, way to go Hitler. Maybe we should bring back the old Popeye episodes where the Japanese are depicted as semi-clever, buck-toothed monkey-men, too. While we're at it, we could revert back to the old name and image for Cook's Chicken.

  • wtf (unregistered) in reply to frits
    frits:
    wtf:
    Kyle Z.:
    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see.

    Okay, now you're going over the line. Looney Tunes isn't "shit", Looney Tunes is the shit! (gotta get the originals, though. The sanitized versions are useless.)

    Oh sure, way to go Hitler. Maybe we should bring back the old Popeye episodes where the Japanese are depicted as semi-clever, buck-toothed monkey-men, too. While we're at it, we could revert back to the old name and image for Cook's Chicken.

    Exactly! Thank God for a voice of reason round here, cheers for the support frits.
  • somedude (unregistered) in reply to CoderDan
    CoderDan:
    *:
    The Real WTF is that they didn't use BobX.
    <xbobfuncdef name="GetDAO">
      <xbobtry>
        <xbobfuncreturn>
          <xbobcall func="Activator.CreateInstance">
        <xbobendfuncreturn>
        <xbobcatch type="ArgumentNullException">
          <xbobthrow>
        <xbobendcatch>
        ...
        <xbobcatch type="TypeLoadException">
          <xbobthrow>
        <xbobendcatch>
      <xbobendtry>
    <xbobfuncenddef>
    

    +1

    +1

  • wtf (unregistered) in reply to frits
    frits:
    wtf:
    Kyle Z.:
    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see.

    Okay, now you're going over the line. Looney Tunes isn't "shit", Looney Tunes is the shit! (gotta get the originals, though. The sanitized versions are useless.)

    Oh sure, way to go Hitler. Maybe we should bring back the old Popeye episodes where the Japanese are depicted as semi-clever, buck-toothed monkey-men, too. While we're at it, we could revert back to the old name and image for Cook's Chicken.

    Oh, you're talking about the old episodes, with the racist depictions of black characters? "Coal Black and de Sebbin Dwarves", that sort of thing? That's not what I was referring to. There aren't sanitized versions of those, you can't get them at all (officially). It would be hard to clean those up. You can find them, if you look, but they're not actually that funny.

    I'm talking about the clumsy editing that was forced on them in the 80s and 90s - cutting out the scenes that were taken as "violent", and destroying the rhythm of the cartoon. The expurgated versions are about as funny as a mackerel.

  • wtf (unregistered) in reply to wtf
    wtf:
    Exactly! Thank God for a voice of reason round here, cheers for the support frits.

    What a coincidence! Is your name William T. Friedenhoffer as well?

  • (cs) in reply to wtf
    wtf:
    frits:
    wtf:
    Kyle Z.:
    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see.

    Okay, now you're going over the line. Looney Tunes isn't "shit", Looney Tunes is the shit! (gotta get the originals, though. The sanitized versions are useless.)

    Oh sure, way to go Hitler. Maybe we should bring back the old Popeye episodes where the Japanese are depicted as semi-clever, buck-toothed monkey-men, too. While we're at it, we could revert back to the old name and image for Cook's Chicken.

    Oh, you're talking about the old episodes, with the racist depictions of black characters? "Coal Black and de Sebbin Dwarves", that sort of thing? That's not what I was referring to. There aren't sanitized versions of those, you can't get them at all (officially). It would be hard to clean those up. You can find them, if you look, but they're not actually that funny.

    I'm talking about the clumsy editing that was forced on them in the 80s and 90s - cutting out the scenes that were taken as "violent", and destroying the rhythm of the cartoon. The expurgated versions are about as funny as a mackerel.

    My bad. I wasn't even aware of the "edited for violence" versions. I haven't watched Looney Tunes for ~25 years.

  • wtf (unregistered) in reply to frits
    frits:

    My bad. I wasn't even aware of the "edited for violence" versions. I haven't watch Looney Tunes for ~25 years.

    I haven't seen them in a while myself. Maybe I'll try to dig them up - I still think they're some of the best comedy America has come up with.

  • The Real, Non-Random Steve (unregistered) in reply to frits
    frits:
    wtf:
    Kyle Z.:
    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see.

    Okay, now you're going over the line. Looney Tunes isn't "shit", Looney Tunes is the shit! (gotta get the originals, though. The sanitized versions are useless.)

    Oh sure, way to go Hitler. Maybe we should bring back the old Popeye episodes where the Japanese are depicted as semi-clever, buck-toothed monkey-men, too. While we're at it, we could revert back to the old name and image for Cook's Chicken.

    "As an online discussion grows longer, the probability of a comparison involving Nazis or Hitler approaches 1." -Godwin

  • (cs)

    Gotta catch 'em all.

  • wtf (unregistered) in reply to The Real, Non-Random Steve
    The Real:
    "As an online discussion grows longer, the probability of a comparison involving Nazis or Hitler approaches 1." -Godwin

    In this case, if you've ever seen the episodes Frits thought I was referring to, you'll understand how a Hitler reference seemed appropriate. They're pretty grotesque. If I ran into someone who watched them for fun, I'd be a little concerned too.

  • (cs) in reply to The Real, Non-Random Steve

    You're so right!!! They should name a law after that guy based on that principle.

  • Shirt Monkey (unregistered)

    You jest, but this type of coding is catching on.

  • iMalc (unregistered)

    catch and rethrow? Looks more like a fumble to me!

  • (cs) in reply to Mr. Jackson
    Mr. Jackson:
    The Nerve:
    So then I think this would be the fighting monkey pattern.

    THAT'S IT! I have had it with these monkey fighting code snippets on this Monday-Friday website!

    Watched SOAP on cable, did you?

  • HAH (unregistered)

    gotta catch 'em all. pokemon.

  • Poke-ur-Mom (unregistered) in reply to HAH
    HAH:
    gotta catch 'em all. pokemon.

    I assume you mean venereal diseases from boinking pokemon?

  • fs111 (unregistered)

    I think this is called the Pokémon antipattern, gotta catch 'em all!

  • (cs) in reply to somedude
    somedude:
    Abdiel:
    do || !do;

    if (false) try {}

    There is no try, only do.

    Lacking in Star Wars familiarity somedude is.

    Do or do not. There is no try.

  • The Nerve (unregistered) in reply to RogerC

    Is it just me, or are these comments already starting to repeat?

  • zeno (unregistered) in reply to The Nerve
    The Nerve:
    Is it just me, or are these comments already starting to repeat?

    Is it just me, or are these comments already starting to repeat?

  • Anonymous Coward (unregistered) in reply to zeno
    zeno:
    The Nerve:
    Is it just me, or are these comments already starting to repeat?

    Is it just me, or are these comments already starting to repeat?

    Is it just me, or are these comments already starting to repeat?

  • thumb (unregistered) in reply to Anonymous

    Makes it better because.. there is no wtf here. More like elitist coders making fun of something that there is nothing wrong with because they want to pretend they know something that has little to do with reality.

  • It's just you.... (unregistered) in reply to Anonymous Coward

    Is it just me, or are these comments already starting to repeat?

  • (cs) in reply to Anonymous Coward

    try {

    Anonymous Coward:
    zeno:
    The Nerve:
    Is it just me, or are these comments already starting to repeat?

    Is it just me, or are these comments already starting to repeat?

    Is it just me, or are these comments already starting to repeat?

    } catch (Exception comment) { throw new CommentException ("FileNotFound", comment); } finally { MakeUnfunnyCommentOfMyOwn(); }

  • (cs) in reply to LightStyx
    LightStyx:
    IndexOutOfRangeException! I choose you! *throws exception* Use InnerException now!
    It's super effective!
  • PRMan (unregistered) in reply to Zach
    Zach:
    At least the dev didn't just catch the general exception.
    Public Function GetDAO(ByVal typeName As String) As Object
        Try
            Return Activator.CreateInstance(System.Type.GetType(typeName, True, True))
        Catch ex As Exception
            Throw
        End Try
    End Function

    But if all you're going to do is throw it there's no point in catching. This isn't baseball.

    And yet the result is nearly identical...

  • (cs) in reply to John
    John:
    The WTF is it doesnt handle FileNotFoundException. And it should also get the list of exceptions from an XML file. obviously.
    But then how do you handle XMLFileNotFoundException?

    Well of course you need a separate exception for XML files not being found. XML files are likely to be much more important to the business process than regular files, so an XMLFileNotFoundException is usually going to be more serious than a FileNotFoundException.

  • Ben (unregistered) in reply to Zach
    Zach:
    But if all you're going to do is throw it there's no point in catching. This isn't baseball.

    If you're stepping through it with a debuggerer, you'll see which exception was thrown or you can set a breakpoint for a particular exception.

  • HockeyMonkey (unregistered) in reply to Poke-your-Mom
    , I was amused how "Pikachu: you are the distinct individual [whom] I have chosen!" was translated.
    In Danish "Pikachu" could mean "Dick Sneeze"
  • The 2-Belo (unregistered) in reply to wtf
    wtf:
    Kyle Z.:
    Maybe he's jealous 'cause when he's a child he only have Looney Tunes shit to see.

    Okay, now you're going over the line. Looney Tunes isn't "shit", Looney Tunes is the shit! (gotta get the originals, though. The sanitized versions are useless.)

    I was about to say, when I was 12, I was watching Speed Racer. But then I remembered that hipster college pukes would watch that show in the 1990s, too.

  • Yoda (unregistered) in reply to The 2-Belo

    if(going_to_raise_x-wing_from_swamp) { /* try { do('raise x-wing from swamp'); } catch (InsufficientForceException $e) { throw $e; } */ // Do, or do not. There is no try. -Yoda

    do('raise x-wing from swamp');	
    

    } else { // leave it there }

  • (cs)

    try_again would be very useful in C++ where you don't get any context as to where your exception was thrown.

    When you catch an exception get it to go back so you can trace through this time and see where it got thrown.

Leave a comment on “Try... Catch-em-all”

Log In or post as a guest

Replying to comment #:

« Return to Article