more error logging and handling
This commit is contained in:
@@ -27,6 +27,10 @@ WMOAreaTableDB gWMOAreaTableDB;
|
||||
|
||||
void OpenDBs(std::shared_ptr<BlizzardArchive::ClientData> clientData)
|
||||
{
|
||||
Log << "Opening client DBCs..." << std::endl;
|
||||
|
||||
try
|
||||
{
|
||||
gAreaDB.open(clientData);
|
||||
gMapDB.open(clientData);
|
||||
gLoadingScreensDB.open(clientData);
|
||||
@@ -45,6 +49,16 @@ void OpenDBs(std::shared_ptr<BlizzardArchive::ClientData> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -168,8 +168,13 @@ namespace Noggit::Ui::Component
|
||||
}
|
||||
case QMessageBox::DestructiveRole:
|
||||
default:
|
||||
{
|
||||
LogError << "Failed to convert uppercase sensitive project." << std::endl;
|
||||
assert(false);
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user