Re: catching errors from BDI.pm

From: Ed Loehr <eloehr(at)austin(dot)rr(dot)com>
To: Jeffrey <seesej(at)uswest(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: catching errors from BDI.pm
Date: 2000-04-17 03:12:25
Message-ID: 38FA8119.1BFDAC96@austin.rr.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

IIRC, certain kinds of pg errors trigger exceptions that can only be caught
with an eval wrapper. Not sure, but the DBD::Pg module may just be
parroting the bail-out behavior of the backend.

Regards,
Ed Loehr

Jeffrey wrote:
>
> Hi,
>
> I am having trouble catching errors from postgress. I am connecting to the
> database via perl and DBI.pm The following will work
>
> ($dbh = DBI->connect("$dsn", "", "") ) or (print $DBI::errstr and exit());
>
> But this wont (from deliberately spelled wrong)
> ($sth=$dbh->prepare("select * form tablename")) || (
> # error
> print "\nError".$dbh->errstr
> # error
> );
>
> Actually it will work from a telnet prompt, but if I run this script in a
> cgi, it writes the error to the error log instead of the standard out. It
> does not execute the code inside the error comments.
>
> Thank you for your help
> Jeff Seese

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Haroldo Stenger 2000-04-17 04:47:46 Re: Does error within transaction imply restarting it?
Previous Message Titus Brown 2000-04-17 03:09:47 Re: To BLOB Or Not To BLOB