Skip to content

Commit

Permalink
libcore: Improved package error handling
Browse files Browse the repository at this point in the history
An error in the package metadata shouldn’t cause the engine to shut down.
  • Loading branch information
skyjake committed Oct 27, 2018
1 parent c5acf77 commit 5b2cb64
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions doomsday/sdk/libcore/src/filesys/packageloader.cpp
Expand Up @@ -176,9 +176,21 @@ DENG2_PIMPL(PackageLoader)
}

// Each must have a version specified.
DENG2_FOR_EACH_CONST(FS::FoundFiles, i, found)
{
checkPackage(**i);
FS::FoundFiles checked;
DENG2_FOR_EACH_CONST(FS::FoundFiles, i, found)
{
try
{
checkPackage(**i);
checked.push_back(*i);
}
catch (const Error &)
{
// Packages with errors cannot be selected.
}
}
found = std::move(checked);
}

// If the identifier includes a version, only accept that specific version.
Expand Down Expand Up @@ -299,6 +311,10 @@ DENG2_PIMPL(PackageLoader)
LOG_RES_WARNING("\"%s\": Package has a syntax error: %s")
<< fileName << er.asText();
}
catch (const Error &er)
{
LOG_RES_WARNING("\"%s\": %s") << fileName << er.asText();
}

/// @todo Store the errors so that the UI can show a list of
/// problematic packages. -jk
Expand Down

0 comments on commit 5b2cb64

Please sign in to comment.