$sth->execute or do_error($DBI::errstr); sub do_error { my $error=shift; return if $error =~ /Relation already exists/; # or whatever the actual error is die "A serious problem occured. According to the rumours: $error.\n"; }