mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-25 03:55:26 +01:00
add logs the detailed error message in php (#595)
* add logs the detailed error message in php * add more details in every error callback (php) * remove err details from err CB to logger, for avoid leaking private information
This commit is contained in:
parent
b422640a76
commit
d5fe7175c6
@ -149,7 +149,10 @@ if (startsWith($path, "/maps/")) {
|
||||
try {
|
||||
$sql = new PDO("$driver:host=$hostname;port=$port;dbname=$database", $username, $password);
|
||||
$sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
} catch (PDOException $e ) { error(500, "Failed to connect to database"); }
|
||||
} catch (PDOException $e ) {
|
||||
error_log($e->getMessage(), 0); // Logs the detailed error message
|
||||
error(500, "Failed to connect to database");
|
||||
}
|
||||
|
||||
// provide map-tiles
|
||||
if (startsWith($mapPath, "tiles/")) {
|
||||
@ -199,7 +202,10 @@ if (startsWith($path, "/maps/")) {
|
||||
exit;
|
||||
}
|
||||
|
||||
} catch (PDOException $e) { error(500, "Failed to fetch data"); }
|
||||
} catch (PDOException $e) {
|
||||
error_log($e->getMessage(), 0);
|
||||
error(500, "Failed to fetch data");
|
||||
}
|
||||
|
||||
// no content if nothing found
|
||||
http_response_code(204);
|
||||
@ -238,7 +244,10 @@ if (startsWith($path, "/maps/")) {
|
||||
send($line["data"]);
|
||||
exit;
|
||||
}
|
||||
} catch (PDOException $e) { error(500, "Failed to fetch data"); }
|
||||
} catch (PDOException $e) {
|
||||
error_log($e->getMessage(), 0);
|
||||
error(500, "Failed to fetch data");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user