From 460091fb0b2ff114cc741372f15bb43b702ea3b1 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:24:35 +0200 Subject: 5.16 --- lib/status_handler_impl.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'lib/status_handler_impl.h') 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 #include #include "process_callback.h" +//template 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 inline -bool tryReportingError(Function cmd, ProcessCallback& handler) //return "true" on success, "false" if error was ignored +zen::Opt 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 -- cgit