diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:24:35 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:24:35 +0200 |
commit | 460091fb0b2ff114cc741372f15bb43b702ea3b1 (patch) | |
tree | 0562c2eda4c66969c6e6d0910080db9f5b0def3e /lib/status_handler_impl.h | |
parent | 5.15 (diff) | |
download | FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.gz FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.tar.bz2 FreeFileSync-460091fb0b2ff114cc741372f15bb43b702ea3b1.zip |
5.16
Diffstat (limited to 'lib/status_handler_impl.h')
-rw-r--r-- | lib/status_handler_impl.h | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/lib/status_handler_impl.h b/lib/status_handler_impl.h index 615288d2..e1212b65 100644 --- a/lib/status_handler_impl.h +++ b/lib/status_handler_impl.h @@ -7,28 +7,52 @@ #ifndef STATUSHANDLER_IMPL_H_INCLUDED #define STATUSHANDLER_IMPL_H_INCLUDED +#include <zen/optional.h> #include <zen/file_error.h> #include "process_callback.h" +//template <typename Function> inline +//bool tryReportingError(Function cmd, ProcessCallback& handler) //return "true" on success, "false" if error was ignored +//{ +// for (;;) +// try +// { +// cmd(); //throw FileError +// return true; +// } +// catch (zen::FileError& error) +// { +// switch (handler.reportError(error.toString())) //may throw! +// { +// case ProcessCallback::IGNORE_ERROR: +// return false; +// case ProcessCallback::RETRY: +// break; //continue with loop +// } +// } +//} + + template <typename Function> inline -bool tryReportingError(Function cmd, ProcessCallback& handler) //return "true" on success, "false" if error was ignored +zen::Opt<std::wstring> tryReportingError2(Function cmd, ProcessCallback& handler) //return ignored error message if available { for (;;) try { cmd(); //throw FileError - return true; + return zen::NoValue(); } catch (zen::FileError& error) { switch (handler.reportError(error.toString())) //may throw! { case ProcessCallback::IGNORE_ERROR: - return false; + return error.toString(); case ProcessCallback::RETRY: break; //continue with loop } } } + #endif //STATUSHANDLER_IMPL_H_INCLUDED |