diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:28:01 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:28:01 +0200 |
commit | fe9eb89ebc1b3c33cbac00a3fa095a14faef9113 (patch) | |
tree | 8a3bb620a9acb83fe0057061a86e8f2cb91a9fe1 /lib/status_handler_impl.h | |
parent | 5.21 (diff) | |
download | FreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.tar.gz FreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.tar.bz2 FreeFileSync-fe9eb89ebc1b3c33cbac00a3fa095a14faef9113.zip |
5.22
Diffstat (limited to 'lib/status_handler_impl.h')
-rw-r--r-- | lib/status_handler_impl.h | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/lib/status_handler_impl.h b/lib/status_handler_impl.h index e1212b65..210e6ecd 100644 --- a/lib/status_handler_impl.h +++ b/lib/status_handler_impl.h @@ -11,32 +11,11 @@ #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 -zen::Opt<std::wstring> tryReportingError2(Function cmd, ProcessCallback& handler) //return ignored error message if available +zen::Opt<std::wstring> tryReportingError(Function cmd, ProcessCallback& handler) //return ignored error message if available { - for (;;) + for (size_t retryNumber = 0;; ++retryNumber) try { cmd(); //throw FileError @@ -44,7 +23,7 @@ zen::Opt<std::wstring> tryReportingError2(Function cmd, ProcessCallback& handler } catch (zen::FileError& error) { - switch (handler.reportError(error.toString())) //may throw! + switch (handler.reportError(error.toString(), retryNumber)) //may throw! { case ProcessCallback::IGNORE_ERROR: return error.toString(); |