• (cs) in reply to

    :
    What's wrong with this code?  It looks like good enterprise-quality code to me.  What else is he supposed to do it the function cannot return true?  I suppose some of you would simply trust that the underlying code to execute "Return True" will run without an error.  I, for one, prefer to create solid, robust code, not like other people who just make assumptions about what the compiler will do.

     

    I think it is impossible for "Return True" to create an error.

    I mean the function even returns Boolean. If you prefer to create solid robust code then i suggest you study more or something.

    Your comment is a WTF to me.

  • (cs) in reply to AndrewVos

    Another WTF is that this topic has the word robust spelled as robost in some of the replies here. [:P]

    I guess someone made a spelling error and decided to correct it. Too bad you forgot a few places, Alex... [:S]

  • (cs) in reply to

    :
    What's wrong with this code?  It looks like good enterprise-quality code to me.  What else is he supposed to do it the function cannot return true?  I suppose some of you would simply trust that the underlying code to execute "Return True" will run without an error.  I, for one, prefer to create solid, robust code, not like other people who just make assumptions about what the compiler will do.

     

    I think it is impossible for "Return True" to create an error.

    I mean the function even returns Boolean. If you prefer to create solid robust code then i suggest you study more or something.

    Your comment is a WTF to me.

  • (cs) in reply to

    :
    What's wrong with this code?  It looks like good enterprise-quality code to me.  What else is he supposed to do it the function cannot return true?  I suppose some of you would simply trust that the underlying code to execute "Return True" will run without an error.  I, for one, prefer to create solid, robust code, not like other people who just make assumptions about what the compiler will do.

     

    I think it is impossible for "Return True" to create an error.

    I mean the function even returns Boolean. If you prefer to create solid robust code then i suggest you study more or something.

    Your comment is a W.T.F to me.

  • (cs) in reply to AndrewVos

    Andrew, posting your message over and over again is another WTF... [:$]

  • (cs) in reply to Katja

    There is, actually, a way an exception could occur in that line. This would however not come from the actual 'return true' line, but this would be an asynchronous exception triggered from the outside, for instance a ThreadAbortException (actually that's the only one I can think of, but still).

    This still wouldn't be good code though... if just because you should never ever catch Exception. For instance when a ThreadAbortException occurs they will catch it, and turn it into a different kind of exception, causing the thread not to abort. If that was their intention, which I sincerely doubt, they should've made that explicit by handling ThreadAbortException.

  • (unregistered)

    This code doesn't seem overly strange to me. The previous two companies I worked for had strict coding standards that HAD to be followed at all costs. Sure, it meant writing a ton of useless code, but it also helped to enforce certain practices and helped the companies maintain their ISO9001 certification. All functions we wrote were generated using pre-defined templates that filled in error handling. Anything that didn't contain the company-mandated error handling (or a ridiculously large, 30+ line comment header) would result in your being hauled in front of the management team to explain why before being made to fix the code.

    Looking at this code, it smells of similar auto-generation. It looks as if VB6 templates were ported into VB.NET without much real thought. One company I worked for had VB6 templates written by a C programmer who had no understanding of VB, unfortunately he was a director in the company so we had to follow his standards. This meant we had some seriously wonky error-handling code, but if you wanted to keep your job, you wrote the code they wanted.

    Without seeing any other code in the same project we will never know for sure, but I wouldn't be surprised to see the same error handling throughout.

    The real WTF is that the function only returns true. Maybe as some have suggested this is either a stub, or the real check has been made redundant but the function is left in because it is being called from several other places?

  • (unregistered) in reply to Katja

    Katja:
    Another WTF is that this topic has the word robust spelled as robost in some of the replies here. Stick out tongue

    You're from the Netherlands! How can you correct us on such things?

    (Actually, I'm just jealous of your intellect...but that's besides the point!)

    [8o|] Arrrggghhh! [8o|]

  • (cs) in reply to
    :
    I meant to write "I think Jon Limjap missed the joke" but something ate the non-quote section of my post


    Hard to catch a joke when it's all written by Anonymous.

    Error catching and joke catching... hmmm [^o)]. Must work the same way for this WTF. This try catch is practically a joke.

    I wonder if the code would look like this...

    [code language="vb"]
    try
    Return True
    catch WTF as Punchline
    Console.WriteLine(WTF.Message)
    end try
    [/code]

  • (cs) in reply to Jon Limjap
    Jon Limjap:
    Holy WTF! I'm sure there's some way that 'Return True' would generate a very complex error!

    Is the sole purpose of the function to return True? Must be generating so much heat in the CPU that it goes unstable and throws random exceptions, thus the pre-cautionary steps.
  • ELIZA (unregistered) in reply to AndrewVos

    I agree, Andrew: How can the anonymous man* trust the error handling keywords to work? If you can't trust Return True, who can you trust?

    But not the Anonymous Man: He is not anonymous but pseudonymous.

Leave a comment on “Robust Error Handling ”

Log In or post as a guest

Replying to comment #:

« Return to Article