1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Improve error handling of map database creation

This commit is contained in:
sfan5 2025-02-26 18:50:41 +01:00
parent 7abaa8d4cd
commit d54646d342
7 changed files with 71 additions and 32 deletions

View file

@ -473,8 +473,15 @@ void Server::init()
EnvAutoLock envlock(this);
// Create the Map (loads map_meta.txt, overriding configured mapgen params)
auto startup_server_map = std::make_unique<ServerMap>(m_path_world, this,
m_emerge.get(), m_metrics_backend.get());
std::unique_ptr<ServerMap> startup_server_map;
try {
startup_server_map = std::make_unique<ServerMap>(m_path_world, this,
m_emerge.get(), m_metrics_backend.get());
} catch (DatabaseException &e) {
throw ServerError(std::string(
"Failed to initialize the map database. The world may be "
"corrupted or in an unsupported format.\n") + e.what());
}
// Initialize scripting
infostream << "Server: Initializing Lua" << std::endl;