From a6ab3436d0c464e954bdeac13320fcb4b16c622a Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 10 Jun 2011 15:21:20 -0400 Subject: [PATCH] Better error message on failure to add dbgroup mapping. --- bucardo | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bucardo b/bucardo index 85e7dc0fe..1038095be 100755 --- a/bucardo +++ b/bucardo @@ -8293,7 +8293,16 @@ sub add_db_to_group { $SQL = 'INSERT INTO bucardo.dbmap(db,dbgroup,role) VALUES (?,?,?)'; $sth = $dbh->prepare($SQL); - $sth->execute($db,$group,$role); + eval { + $sth->execute($db,$group,$role); + }; + if ($@) { + my $msg = qq{Cannot add database "$db" to group "$group"}; + if ($@ =~ /"db_dsn_unique"/) { + die qq{$msg: already have that entry\n}; + } + die qq{$msg: $@\n}; + } ## Reload our hashes load_bucardo_info(1); -- 2.39.5