diff --git a/src/Container.cpp b/src/Container.cpp index 2b61af6..e41d4a3 100644 --- a/src/Container.cpp +++ b/src/Container.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include @@ -96,7 +95,7 @@ void Container::parseLibraryThread(std::vector*> aStream catch(...) { parsedSuccessfully = false; - exceptionHandling(); + (*stream)->exceptionHandling(); } (*stream)->mCtx.mParsedSuccessfully = parsedSuccessfully; @@ -204,29 +203,6 @@ void Container::parseLibrary() } -void Container::exceptionHandling() -{ - try - { - throw; - } - catch(const std::exception& e) - { - mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "--------ERROR REPORT--------")); - mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Input Container: {}", mCtx.mInputCfbfFile.string())); - // @todo - // mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Current File: {}", mCtx.mInputStream.string())); - // mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), mCtx.mDs.getCurrentOffsetStrMsg())); - mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "\nError Message: {}\n\n", e.what())); - } - catch(...) - { - mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "--------ERROR REPORT--------")); - mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Unknown exception caught!\n")); - } -} - - fs::path Container::extractContainer(const fs::path& aFile, const fs::path& aOutDir) const { ContainerExtractor extractor{aFile}; diff --git a/src/Container.hpp b/src/Container.hpp index 42888db..905c1b0 100644 --- a/src/Container.hpp +++ b/src/Container.hpp @@ -111,7 +111,6 @@ class Container } private: - void exceptionHandling(); size_t mFileCtr; //!< Counts all files that were opened for parsing size_t mFileErrCtr; //!< Counts all files that failed somewhere diff --git a/src/Stream.hpp b/src/Stream.hpp index 174ca79..d7b3e9f 100644 --- a/src/Stream.hpp +++ b/src/Stream.hpp @@ -7,6 +7,10 @@ #include #include +#include +#include +#include + #include "ContainerContext.hpp" #include "Enums/Structure.hpp" #include "FutureData.hpp" @@ -39,6 +43,27 @@ class Stream : public Component mCtx.mDs.close(); } + void exceptionHandling() + { + try + { + throw; + } + catch(const std::exception& e) + { + mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "--------ERROR REPORT--------")); + mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Input Container: {}", mCtx.mInputCfbfFile.string())); + mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Current File: {}", mCtx.mInputStream.string())); + mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), mCtx.mDs.getCurrentOffsetStrMsg())); + mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "\nError Message: {}\n\n", e.what())); + } + catch(...) + { + mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "--------ERROR REPORT--------")); + mCtx.mLogger.error(fmt::format(fg(fmt::color::crimson), "Unknown exception caught!\n")); + } + } + // protected: StreamContext mCtx; };