Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Let me add to this since I mostly agree. I personally distinguish between 3 types of diagnostics: (1) The user level errors koolade describes above; (2) errors given to prgrammers using a given published API; and (3) full programmer level diagnostics.

I'd agree with koolade's approach, but that only covers the first and third cases. For an applications programmer using some interface I developed, I want to give them that middle ground: Tell them which line of their program is in error but not lead them into a bunch of code they're never supposed to see. So that's where I've used things like $CarpLevel (even though it can be a pain in the arse).

As an example, I wrote a generalized interface for setting up class and instance level attributes. Part of that checks against allowed values, etc. If a programmer calls a method with invalid arguments I simply want to say something like Option FOO is not recognized at line 120 of yourprogram. That's different than a user giving me a bad command line argument, where I'd simply say something like Option -foo is not recognized.. I would not want to show the user in that first message a stack trace though. My experience, like jeffa's is that it just confuses things and they start thinking things are broken that aren't. I would show a stack trace for exceptions that were unexpected; e.g., errors in my underlying code versus errors in usage of that code.


In reply to Re: Re: Confusion about properly using Carp by steves
in thread Confusion about properly using Carp by jeffa

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 19:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found