diff options
Diffstat (limited to 'src/file/errors/registrator.cpp')
-rw-r--r-- | src/file/errors/registrator.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/file/errors/registrator.cpp b/src/file/errors/registrator.cpp new file mode 100644 index 0000000..9389179 --- /dev/null +++ b/src/file/errors/registrator.cpp @@ -0,0 +1,32 @@ +#include <cerrno> + +#include "registrator.hpp" +#include "logger/logger_set.hpp" + +namespace smtp::file::errors +{ + + void Registrator::Add( types::IErrorPtr const& error, int error_code ) + { + mErrorSet.insert( {error_code, error} ); + } + + void Registrator::Process( types::SettingsType settings_type ) const + { + auto find = mErrorSet.find(errno); + if( find == mErrorSet.end() ) + { + DefaultProcess(errno); + } + find->second->Process( settings_type ); + } + + void Registrator::DefaultProcess(int error_code) const + { + static const std::string METHOD = "Open file"; + + std::string message = "Unknown error - " + std::to_string(error_code); + logger::LoggerSet::GetInstance()->LogError( METHOD, message ); + } + +} |