more error logging and handling

This commit is contained in:
T1ti
2024-05-30 20:04:52 +02:00
parent 2abaf5bc46
commit 755c6a1e38
4 changed files with 66 additions and 19 deletions

View File

@@ -27,24 +27,38 @@ WMOAreaTableDB gWMOAreaTableDB;
void OpenDBs(std::shared_ptr<BlizzardArchive::ClientData> clientData)
{
gAreaDB.open(clientData);
gMapDB.open(clientData);
gLoadingScreensDB.open(clientData);
gLightDB.open(clientData);
gLightParamsDB.open(clientData);
gLightSkyboxDB.open(clientData);
gLightIntBandDB.open(clientData);
gLightFloatBandDB.open(clientData);
gGroundEffectDoodadDB.open(clientData);
gGroundEffectTextureDB.open(clientData);
gTerrainTypeDB.open(clientData);
gLiquidTypeDB.open(clientData);
gSoundProviderPreferencesDB.open(clientData);
gSoundAmbienceDB.open(clientData);
gZoneMusicDB.open(clientData);
gZoneIntroMusicTableDB.open(clientData);
gSoundEntriesDB.open(clientData);
gWMOAreaTableDB.open(clientData);
Log << "Opening client DBCs..." << std::endl;
try
{
gAreaDB.open(clientData);
gMapDB.open(clientData);
gLoadingScreensDB.open(clientData);
gLightDB.open(clientData);
gLightParamsDB.open(clientData);
gLightSkyboxDB.open(clientData);
gLightIntBandDB.open(clientData);
gLightFloatBandDB.open(clientData);
gGroundEffectDoodadDB.open(clientData);
gGroundEffectTextureDB.open(clientData);
gTerrainTypeDB.open(clientData);
gLiquidTypeDB.open(clientData);
gSoundProviderPreferencesDB.open(clientData);
gSoundAmbienceDB.open(clientData);
gZoneMusicDB.open(clientData);
gZoneIntroMusicTableDB.open(clientData);
gSoundEntriesDB.open(clientData);
gWMOAreaTableDB.open(clientData);
}
catch (BlizzardArchive::Exceptions::FileReadFailedError const& e)
{
LogError << e.what() << std::endl;
}
catch (...)
{
LogError << "OpenDBs() : unhandled exception" << std::endl;
}
}

View File

@@ -257,6 +257,10 @@ namespace Noggit::Project
LogError << "loadProject() failed, Project is null" << std::endl;
return {};
}
else
{
Log << "loadProject(): Loading Project Data" << std::endl;
}
project_reader.readPalettes(&project.value());
@@ -274,13 +278,19 @@ namespace Noggit::Project
client_archive_locale = BlizzardArchive::Locale::enUS;
}
if (project->projectVersion == ProjectVersion::WOTLK)
else if (project->projectVersion == ProjectVersion::WOTLK)
{
client_archive_version = BlizzardArchive::ClientVersion::WOTLK;
client_build = BlizzardDatabaseLib::Structures::Build("3.3.5.12340");
client_archive_locale = BlizzardArchive::Locale::AUTO;
}
else
{
LogError << "Unsupported project version" << std::endl;
return {};
}
project->ClientDatabase = std::make_shared<BlizzardDatabaseLib::BlizzardDatabase>(dbd_file_directory, client_build);
Log << "Loading Client Path : " << project->ClientPath << std::endl;
@@ -292,19 +302,33 @@ namespace Noggit::Project
}
catch (BlizzardArchive::Exceptions::Locale::LocaleNotFoundError& e)
{
LogError << e.what() << std::endl;
QMessageBox::critical(nullptr, "Error", e.what());
return {};
}
catch (BlizzardArchive::Exceptions::Locale::IncorrectLocaleModeError& e)
{
LogError << e.what() << std::endl;
QMessageBox::critical(nullptr, "Error", e.what());
return {};
}
catch (BlizzardArchive::Exceptions::Archive::ArchiveOpenError& e)
{
LogError << e.what() << std::endl;
QMessageBox::critical(nullptr, "Error", e.what());
return {};
}
catch (...)
{
LogError << "Failed loading Client data. Unhandled exception." << std::endl;
return {};
}
if (!project->ClientData)
{
LogError << "Failed loading Client data." << std::endl;
return {};
}
return std::make_shared<NoggitProject>(project.value());
}

View File

@@ -71,6 +71,10 @@ namespace Noggit::Ui::Windows
{
OpenDBs(project->ClientData);
}
else
{
LogError << "NoggitWindow() : Unsupported project version, skipping loading DBCs." << std::endl;
}
setCentralWidget(_null_widget);

View File

@@ -168,7 +168,12 @@ namespace Noggit::Ui::Component
}
case QMessageBox::DestructiveRole:
default:
{
LogError << "Failed to convert uppercase sensitive project." << std::endl;
assert(false);
return {};
}
}
}
}