From 3f5e4a84fb59340583eae41e93d2b85e315dc74b Mon Sep 17 00:00:00 2001 From: Milan Date: Sat, 17 Feb 2024 20:44:02 +0100 Subject: [PATCH] db.pm: output call stack on error --- lib/calcms/db.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/calcms/db.pm b/lib/calcms/db.pm index 6d4ee4f..1e29eeb 100644 --- a/lib/calcms/db.pm +++ b/lib/calcms/db.pm @@ -52,6 +52,10 @@ sub connect($;$) { my $dbh = DBI->connect( $dsn, $username, $password, { mysql_enable_utf8 => 1 } ) || die "could not connect to database: $DBI::errstr"; $dbh->{RaiseError} = 1; + $dbh->{HandleError} = sub{ + print STDERR join(",",(caller($_))[0..3])."\n" for (1..2); + return 0; + }; $dbh->{'mysql_enable_utf8'} = 1; put( $dbh, "set character set utf8", undef ); put( $dbh, "set names utf8", undef );