示例#1
0
 /// <summary>
 /// Wrap an action and report the results with an ErrReport object. No exceptions will
 /// propagate and a T value will be returned. Check for successful ErrReport before
 /// using the return T value since it may not be valid.
 /// </summary>
 /// <typeparam name="T">The return type</typeparam>
 /// <param name="report">The ErrReport object to initialise</param>
 /// <param name="code">The error code on error</param>
 /// <param name="errMsgFunc">The error message on error function</param>
 /// <param name="func">The function to invoke</param>
 /// <param name="finallyAction">The finally action to invoke</param>
 /// <returns>A T value or default(T) on failure</returns>
 public static T ToErrReport <T>(out ErrReport report, int code, Func <string> errMsgFunc, Func <T> func, Action finallyAction)
 {
     return(WrapErr.WrapTryToErrReport(out report, code, errMsgFunc, func, finallyAction));
 }
示例#2
0
 /// <summary>
 /// Wrap an action and report the results with an ErrReport object. No exceptions will
 /// propagate and a T value will be returned. Check for successful ErrReport before
 /// using the return T value since it may not be valid.
 /// </summary>
 /// <typeparam name="T">The return type</typeparam>
 /// <param name="report">The ErrReport object to initialise</param>
 /// <param name="code">The error code on error</param>
 /// <param name="errMsgFunc">The error message on error function</param>
 /// <param name="func">The function to invoke</param>
 /// <returns>A T value or default(T) on failure</returns>
 public static T ToErrReport <T>(out ErrReport report, int code, Func <string> errMsgFunc, Func <T> func)
 {
     return(WrapErr.WrapTryToErrReport(out report, code, errMsgFunc, func, () => {; }));
 }
示例#3
0
 /// <summary>
 /// Wrap an action and report the results with an ErrReport object. No exceptions will
 /// propagate and a T value will be returned. Check for successful ErrReport before
 /// using the return T value since it may not be valid.
 /// </summary>
 /// <typeparam name="T">The return type</typeparam>
 /// <param name="report">The ErrReport object to initialise</param>
 /// <param name="code">The error code on error</param>
 /// <param name="msg">The error message on error</param>
 /// <param name="func">The function to invoke</param>
 /// <param name="finallyAction">The finally action to invoke</param>
 /// <returns>A T value or default(T) on failure</returns>
 public static T ToErrReport <T>(out ErrReport report, int code, string msg, Func <T> func, Action finallyAction)
 {
     return(WrapErr.WrapTryToErrReport(out report, code, () => { return msg; }, func, finallyAction));
 }
示例#4
0
 /// <summary>
 /// Wrap an action and report the results with an ErrReport object. No exceptions will propegate
 /// and a finally will be executed.  The error message is an anonymous method to prevent costly
 /// string formating when no error.
 /// </summary>
 /// <param name="report">The ErrReport object to initialise</param>
 /// <param name="code">The error code on error</param>
 /// <param name="errMsgFunc">The error message on error function</param>
 /// <param name="action">The action to invoke</param>
 /// <param name="finallyAction">The finally action to invoke</param>
 public static void ToErrReport(out ErrReport report, int code, Func <string> errMsgFunc, Action action, Action finallyAction)
 {
     report = WrapErr.WrapTryToErrReport(code, errMsgFunc, action, finallyAction);
 }
示例#5
0
 /// <summary>
 /// Wrap an action and report the results with an ErrReport object. No exceptions will
 /// propagate and a T value will be returned. Check for successful ErrReport before
 /// using the return T value since it may not be valid.
 /// </summary>
 /// <typeparam name="T">The return type</typeparam>
 /// <param name="report">The ErrReport object to initialise</param>
 /// <param name="code">The error code on error</param>
 /// <param name="msg">The error message on error</param>
 /// <param name="func">The function to invoke</param>
 /// <returns>A T value or default(T) on failure</returns>
 public static T ToErrReport <T>(out ErrReport report, int code, string msg, Func <T> func)
 {
     return(WrapErr.WrapTryToErrReport(out report, code, () => { return msg; }, func, () => {; }));
 }
示例#6
0
 /// <summary>
 /// Wrap an action and report the results with an ErrReport object. No exceptions will
 /// propagate and a finally will be safely executed
 /// </summary>
 /// <param name="report">The ErrReport object to initialise</param>
 /// <param name="code">The error code on error</param>
 /// <param name="msg">The error message on error</param>
 /// <param name="action">The action to invoke</param>
 /// <param name="finallyAction">The finally action to invoke</param>
 public static void ToErrReport(out ErrReport report, int code, string msg, Action action, Action finallyAction)
 {
     report = WrapErr.WrapTryToErrReport(code, () => { return(msg); }, action, finallyAction);
 }
示例#7
0
 /// <summary>
 /// Wrap an action and report the results with an ErrReport object. No exceptions will propegate
 /// </summary>
 /// <param name="report">The ErrReport object to initialise</param>
 /// <param name="code">The error code on error</param>
 /// <param name="action">The action to invoke</param>
 public static void ToErrReport(out ErrReport report, int code, Action action)
 {
     report = WrapErr.WrapTryToErrReport(code, () => { return(REPLACE_WITH_EXCEPTION_MSG); }, action, () => {; });
 }
示例#8
0
 /// <summary>
 /// Wrap to an ErrReport that is not accessible by user. The results will
 /// be logged if the delegate is assigned to the Wrap architecture
 /// </summary>
 /// <param name="code">The error code on error</param>
 /// <param name="msg">The message formating function</param>
 /// <param name="action">The action to invoke</param>
 /// <param name="code"></param>
 public static void ToErrReport(int code, Func <string> msg, Action action)
 {
     ErrReport err = WrapErr.WrapTryToErrReport(code, msg, action, () => {; });
 }
示例#9
0
 /// <summary>
 /// Wrap to an ErrReport that is not accessible by user. The results will
 /// be logged if the delegate is assigned to the Wrap architecture
 /// </summary>
 /// <param name="code">The error code on error</param>
 /// <param name="msg">The message</param>
 /// <param name="action">The action to invoke</param>
 /// <param name="code"></param>
 public static void ToErrReport(int code, string msg, Action action)
 {
     ErrReport err = WrapErr.WrapTryToErrReport(code, () => { return(msg); }, action, () => {; });
 }
示例#10
0
 /// <summary>
 /// Wrap to an ErrReport that is not accessible by user. The results will
 /// be logged if the delegate is assigned to the Wrap architecture
 /// </summary>
 /// <param name="code">The error code on error</param>
 /// <param name="action">The action to invoke</param>
 /// <param name="finallyAction">The action on the finally</param>
 public static void ToErrReport(int code, Action action, Action finallyAction)
 {
     ErrReport err = WrapErr.WrapTryToErrReport(code, () => { return(REPLACE_WITH_EXCEPTION_MSG); }, action, finallyAction);
 }