File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -252,9 +252,14 @@ if ( $OPTS{'d'} ) {
252252 }
253253
254254 # test the connection
255- my $dbh = DBI-> connect ( $DBI_DSN , $DBI_USER , $DBI_PASS )
256- or die " DBI Error: $! " ;
257- $dbh -> disconnect;
255+ eval {
256+ my $dbh = DBI-> connect ( $DBI_DSN , $DBI_USER , $DBI_PASS )
257+ or die " DBI Error: $! " ;
258+ $dbh -> disconnect;
259+ };
260+ if ($@ ) {
261+ print " MySQL Connection problem\n " ;
262+ }
258263
259264 # SIGALRM dumps the tracker hash
260265 $SIG {ALRM } = \&dump_tracker;
@@ -503,7 +508,8 @@ sub open_errorlog {
503508
504509# sub to update the database with the tracker data
505510sub dump_tracker {
506- if ( keys (%tracker ) > 0 ) {
511+ eval {
512+ if ( keys (%tracker ) > 0 ) {
507513 my $dbh = DBI-> connect ( $DBI_DSN , $DBI_USER , $DBI_PASS )
508514 or warn " DBI Error: $! " ;
509515 foreach my $key ( keys (%tracker ) ) {
@@ -529,6 +535,10 @@ sub dump_tracker {
529535 %tracker = ();
530536 }
531537 alarm $DBI_DUMP ;
538+ };
539+ if ($@ ) {
540+ print " Unable to store vlogger data in database\n " ;
541+ }
532542}
533543
534544# print usage info
You can’t perform that action at this time.
0 commit comments