Add error string to exception messages

This commit is contained in:
TheAssassin
2018-06-03 03:07:23 +02:00
parent 364afc384d
commit 8ec2f00448

View File

@@ -14,10 +14,10 @@ namespace linuxdeploy {
public:
PrivateData() noexcept(false) {
cookie = magic_open(MAGIC_DEBUG | MAGIC_SYMLINK | MAGIC_MIME_TYPE);
cookie = magic_open(MAGIC_CHECK | MAGIC_MIME_TYPE | MAGIC_MIME_ENCODING);
if (cookie == nullptr)
throw MagicError("Failed to open magic database");
throw MagicError("Failed to open magic database: " + std::string(magic_error(cookie)));
}
~PrivateData() {
@@ -40,7 +40,7 @@ namespace linuxdeploy {
const auto* buf = magic_file(d->cookie, path.c_str());
if (buf == nullptr)
return "";
throw MagicError("magic_file() failed: " + std::string(magic_error(d->cookie)));
return buf;
}