Custom error handlers 

$dbh->{HandleError} = sub {
    my ( $error, $dbh ) = @_;
    die {
        culprit => 'DBI',
        error   => $dbh->err,
        errstr  => $dbh->errstr,
        string  => $error,
    };
};

# ...

eval { $dbh->do('INSERT...'); };

if ( $@ ) {
    print "blame ", $@->{culprint}, "\n" if ref $@ eq 'HASH';
}