Add error handling
This commit is contained in:
30
openVulkanoCpp/IO/Archive/ArchiveBase.cpp
Normal file
30
openVulkanoCpp/IO/Archive/ArchiveBase.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user