Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
My philosophy is to validate the heck out of anything the user has to say. Concentrate all of the validation checks into one place and give the user actionable information about what is wrong and then assume in the rest of the code that the input is valid...well sort of...I give an example of some code that I am working on...
sub compare2records { my ($x, $y) = @_; # $x and $y are array refs to DB records my $result =0; #typical message might be.... #Argument "13ND" isn't numeric...blah...blah local $SIG{__WARN__} = sub { my $msg = shift; print STDERR "*******\n"; print STDERR $msg; #has a \n in $msg print STDERR "current DB record: id=", $x->[$dbc_id]; ...other complicated info for developers... print STDERR " other DB record: id=",$y->[$dbc_id],"\n"; print STDERR "*******\n"; }; ... complex comparisons happen here.... ... a non-numeric field in the DB that should be numeric will ... cause an error and will be intercepted by the SIGNAL handler ... these are messages intended for the develop team ... ... the user shouldn't see this, it means we screwed up on ... data validation and it is "our" problem, not a user ... problem! We have to fix code, this is past user has to ... fix his/her input! A user input error should not have ... gotten this far! }
The idea here is that this SIGNAL handler should never be executed. If it does execute, then the info is for the development team and we have to fix a problem regardless of the user. This is an example of "OUR" problem versus "YOUR" problem as a user. We have "our" problem because of some issue that we failed to tell you, the user about further upstream.

So, this is a bit of a mix. The further down in the code that an inconsistency is found, the more detailed and more cryptic the error message will be. Find the user input errors early. I don't expect the user to know what the heck an error between 453,203 and 129,385 means - something like that means that we (the SW team) screwed up.

In this application, I get 900+ files from 900+ sources, using 80+ programs to generate the files. Stuff happens. It is not possible to herd 900 chickens into the same roost without good SW or a lot of sheep dogs! Mixed metaphor, but I think you get the idea.

In reply to Re: Error handling by Marshall
in thread Error handling by Ari

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (9)
    As of 2018-11-21 14:47 GMT
    Find Nodes?
      Voting Booth?
      My code is most likely broken because:

      Results (239 votes). Check out past polls.