summaryrefslogtreecommitdiff
path: root/src/management/builder/mail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/management/builder/mail.cpp')
-rw-r--r--src/management/builder/mail.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/management/builder/mail.cpp b/src/management/builder/mail.cpp
index a96fd33..7a8aa42 100644
--- a/src/management/builder/mail.cpp
+++ b/src/management/builder/mail.cpp
@@ -7,6 +7,8 @@
#include "file/mail/checker_decorator.hpp"
#include "file/mail/sort_decorator.hpp"
+#include "file/errors/not_create.hpp"
+
namespace smtp::manage::builder
{
smtp::manage::Mail Mail::Build() const
@@ -18,12 +20,20 @@ namespace smtp::manage::builder
{
static const std::string PATH = {"/var/lib/smtp/mails.txt"};
auto result = std::make_shared<file::mail::SortDecorator>() ;
- result->Apply(std::make_shared<file::mail::CheckerDecorator>( BuildErrorRegistrator() ))
- .Apply(std::make_shared<file::mail::FileDecorator>( PATH ));
+ result->Apply(std::make_shared<file::mail::CheckerDecorator>( BuildSettingsErrorRegistrator() ))
+ .Apply(std::make_shared<file::mail::FileDecorator>( PATH, BuildFileErrorRegistrator(PATH) ));
+ return result;
+ }
+
+ file::errors::Registrator Mail::BuildFileErrorRegistrator( std::string const& path ) const
+ {
+ file::errors::Registrator result;
+ auto not_created_file_error = std::make_shared<file::errors::NotCreatedFile>(path);
+ result.Add(not_created_file_error, ENOENT);
return result;
}
- checker::RegistratorMails Mail::BuildErrorRegistrator() const
+ checker::RegistratorMails Mail::BuildSettingsErrorRegistrator() const
{
checker::RegistratorMails result;
result.Add( std::make_shared < checker::errors::mail::Empty >());