In general, RaiseError is a good idea. However, if, as an example, you were developing yet another Object-relational mapping system, you may want your objects to handle the errors, so you'd turn both PrintError and RaiseError off, and then check for errors and maybe throw an exception as appropriate, for the caller to handle. Since this is another full-fledged exception object at this point, you won't run into zwon's issue of figuring out what type of error it is, and can just handle it appropriately.

Once you've started down this road, perhaps you find problems that your ORM isn't handling quite right, so you want to know what the problem is. You may want to simply enable PrintError in a single location (the connect), and then watch the console for errors. Once you figure out what you're not handling correctly, you can add in the logic, and then turn it back off.

Of course, I'm just grasping at straws here - there are infinite reasons for wanting to do things, not all of them good reasons. But I don't know which, if any, might apply to your situation.


In reply to Re: dbi: PrintError and RaiseError by Tanktalus
in thread dbi: PrintError and RaiseError by perlthirst

Title:
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, details, 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, summary, 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.