×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Where on earth are my errors messages?

Where on earth are my errors messages?

Where on earth are my errors messages?

(OP)
Hi,

I have some DBI code wrapped in a try/catch (Try::Tiny) clause.

CODE

try
{
        # Run SQL Command
        my $sth = $db->prepare("$sel") || die "Error in getSQL ($error): $sel";
        $sth->execute();
}
catch
{
        die "$_ - $! - $@ - $DBI::errstr - $DBI::err";
}; 

Any error from try tiny is meant to be passed to the catch clause via $_,

As you can see I've tried every error variable I can think off, but all I get output is

Quote:

- - - - -

How do I find out why the code is falling over?

Where is the error message?

Thanks,
1DMF

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: Where on earth are my errors messages?

(OP)
I don't know what is going on but it seems impossible to use DBI & Try::Tiny.

I found that using warnings and carp was taking away any catch clause error message.

So I stopped using warnings and carp and now DBI is throwing some ridiculous error that isn't true and still $_ is empty in the catch clause and I have to use $!

I do a simple insert of a record into a table and the try::catch is triggering with a message.

Quote:

Result too large

Huh? What result? The only return I ask for from DBI is number of records inserted

CODE

$rec = $sth->rows; 

Which is 1, how can that be too large?

1DMF <<<< baffled!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: Where on earth are my errors messages?

(OP)
I'm not sure what DBI is doing, but no matter what I am unable to put my code in a Try::Tiny clause without it triggering failure.

I switched to an eval and it seems to work fine?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close