Changed error handling

This commit is contained in:
Robert 2020-12-14 13:31:42 +01:00
parent ac1ac444aa
commit 2c87c93efc

View file

@ -1,5 +1,6 @@
#include <iostream> #include <iostream>
#include <Package.hpp> #include <Package.hpp>
#include <zip.h>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -9,13 +10,13 @@ int main(int argc, char** argv)
return 1; return 1;
} }
try Anki::Package pkg;
int result = pkg.Open(argv[1]);
if (result)
{ {
Anki::Package pkg(argv[1]); zip_error err;
} zip_error_init_with_code(&err, result);
catch (const char* e) std::cerr << "Could not open package: " << zip_error_strerror(&err) << " (" << result << ")" << std::endl;
{
std::cerr << e << std::endl;
} }
return 0; return 0;