Add error handling

This commit is contained in:
2020-12-11 13:06:44 +01:00
parent d99eabafb0
commit fe92d3e431
5 changed files with 97 additions and 30 deletions

View File

@@ -0,0 +1,30 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include "ArchiveBase.hpp"
#include "LibArchiveHelper.hpp"
namespace openVulkanoCpp
{
ArchiveBase::ArchiveBase(archive* arch, archive_entry* archEntry, const std::shared_ptr<spdlog::logger>& logger)
: m_archive(arch), m_archiveEntry(archEntry), m_logger(logger)
{
if (!m_logger)
{
m_logger = Logger::FILESYS;
}
}
ArchiveBase::~ArchiveBase()
{
ChkErr(archive_free(m_archive));
}
bool ArchiveBase::ChkErr(int result) const
{
return LibArchiveHelper::CheckError(result, m_archive, m_logger);
}
}