Merge pull request #1000 from pi-hole/tweak/show_error_on_db_connection_failure

Pass possible exception from SQLite3_connect_try() to the calling pro…
This commit is contained in:
Mark Drobnak
2019-09-03 10:35:40 -04:00
committed by GitHub
+9 -3
View File
@@ -33,7 +33,13 @@ function SQLite3_connect_try($filename, $mode, $trytoreconnect)
if($trytoreconnect)
{
sleep(3);
$db = SQLite3_connect_try($filename, $mode, false);
return SQLite3_connect_try($filename, $mode, false);
}
else
{
// If we should not try again (or are already trying again!), we return the exception string
// so the user gets it on the dashboard
return $filename.": ".$exception->getMessage();
}
}
}
@@ -48,9 +54,9 @@ function SQLite3_connect($filename, $mode=SQLITE3_OPEN_READONLY)
{
die("No database available");
}
if(!$db)
if(is_string($db))
{
die("Error connecting to database");
die("Error connecting to database\n".$db);
}
// Add busy timeout so methods don't fail immediately when, e.g., FTL is currently reading from the DB