get_package_dependencies: catch and report exceptions

The package kit uses exceptions for error handling, but this tool didn't
catch them so all we got in case of error is "Abort" on the error
output.

Now, the exceptions are caught and reported with the complete error
message.
This commit is contained in:
Adrien Destugues 2015-11-09 12:58:51 +01:00
parent 55af491fde
commit 3df0df95cd

View File

@ -14,6 +14,7 @@
#include <map>
#include <package/RepositoryCache.h>
#include <package/manager/Exceptions.h>
#include <package/manager/RepositoryBuilder.h>
#include <package/solver/Solver.h>
#include <package/solver/SolverPackageSpecifier.h>
@ -83,12 +84,13 @@ main(int argc, const char* const* argv)
// add the "installed" repository with the given packages
BSolverRepository installedRepository;
{
BRepositoryBuilder installedRepositoryBuilder(installedRepository,
"installed");
try {
BRepositoryBuilder installedRepositoryBuilder(installedRepository, "installed");
for (int i = 0; i < packageCount; i++)
installedRepositoryBuilder.AddPackage(packages[i]);
installedRepositoryBuilder.AddToSolver(solver, true);
} catch (BFatalErrorException e) {
DIE(B_OK, "%s", e.Details().String());
}
// add external repositories