Re: Error-handling Question
From: Michael A Chase (mchase_at_ix.netcom.com)
Date: 12/15/03
- Next message: Mahtaj Khamneian: "Signal Handling"
- Previous message: murali_at_epiphany.com: "DBD::Proxy::st execute failed: CallMethod: Can't bind unknown placeholder"
- In reply to: Unknown Sender: "Error-handling Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 15 Dec 2003 14:21:44 -0800 (PST) To: paul.boutros@utoronto.ca, dbi-users@perl.org
On Mon, 15 Dec 2003 12:57:32 -0500 paul.boutros@utoronto.ca wrote:
> If I'm handling errors with eval {} if ($@) {} constructs, is there any
> hidden gotcha to grouping several statements in a single eval if I want
> any errors handled identically? For instance, can I wrap an execute
> and its fetches into one eval, as below, or is this something I should
> be wary of?
> if ($@) {
> $dbh->rollback();
> close(OUT);
> print "Error retrieving data\n";
> exit();
> }
It would be useful to know what went wrong. You should either include $@
in the print(), or capture $DBI::errstr before calling rollback() and
print that.
-- Mac :}) ** I usually forward private questions to the appropriate mail list. ** Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age.
- Next message: Mahtaj Khamneian: "Signal Handling"
- Previous message: murali_at_epiphany.com: "DBD::Proxy::st execute failed: CallMethod: Can't bind unknown placeholder"
- In reply to: Unknown Sender: "Error-handling Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|