/// <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, () => {; }); }
/// <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, () => {; }); }
/// <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); }
/// <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, () => {; }); }
/// <summary> /// Wrap a Func to catch and convert exceptions not previously caught and /// converted to ErrReportExceptions. /// </summary> /// <typeparam name="T">The return type</typeparam> /// <param name="code">The error code</param> /// <param name="msg">The error message</param> /// <param name="func">The function to invoke</param> /// <returns>The T type of the func method or default value on error</returns> public static T ToErrorReportException <T>(int code, string msg, Func <T> func, Action finallyAction) { return(WrapErr.WrapTryToErrorReportException(code, () => { return msg; }, func, finallyAction)); }
/// <summary> /// Wrap a Func to catch and convert exceptions not previously caught and /// converted to ErrReportExceptions. Efficient form where error message formating /// Func is not invoked unless there is an error /// </summary> /// <typeparam name="T">The return type</typeparam> /// <param name="code">The unique error code</param> /// <param name="errMsgFunc">The error msg formating method to invoke on failure</param> /// <param name="func">The function to invoke</param> /// <returns>The T type of the func method or default value on error</returns> public static T ToErrorReportException <T>(int code, Func <string> errMsgFunc, Func <T> func, Action finallyAction) { return(WrapErr.WrapTryToErrorReportException(code, errMsgFunc, func, finallyAction)); }
/// <summary> /// Wrap a Func to catch and convert exceptions not previously caught and /// converted to ErrReportExceptions. Efficient form where error message formating /// Func is not invoked unless there is an error /// </summary> /// <typeparam name="T">The return type</typeparam> /// <param name="code">The unique error code</param> /// <param name="errMsgFunc">The error msg formating method to invoke on failure</param> /// <param name="func">The function to invoke</param> /// <returns>The T type of the func method or default value on error</returns> public static T ToErrorReportException <T>(int code, Func <string> errMsgFunc, Func <T> func) { return(WrapErr.WrapTryToErrorReportException(code, errMsgFunc, func, () => {; })); }
/// <summary> /// Wrap a function to catch and convert exceptions not previously caught and /// converted to ErrReportExceptions. /// </summary> /// <param name="code">The error code</param> /// <param name="msg">The error message</param> /// <param name="action">The action to invoke</param> public static T ToErrorReportException <T>(int code, Func <T> func) { return(WrapErr.WrapTryToErrorReportException(code, () => { return REPLACE_WITH_EXCEPTION_MSG; }, func, () => {; })); }
/// <summary> /// Wrap an action to catch and convert exceptions not previously caught and /// converted to ErrReportExceptions. Has a finally action also. Efficient form /// where error message formating Func is not invoked unless there is an error /// </summary> /// <param name="code">The error code</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 ToErrorReportException(int code, Func <string> errMsgFunc, Action action, Action finallyAction) { WrapErr.WrapTryToErrorReportException(code, errMsgFunc, action, finallyAction); }
/// <summary> /// Wrap an action to catch and convert exceptions not previously caught and /// converted to ErrReportExceptions. Has a finally action also /// </summary> /// <param name="code">The error code</param> /// <param name="msg">The error message</param> /// <param name="action">The action to invoke</param> /// <param name="finallyAction">The finally action to invoke</param> public static void ToErrorReportException(int code, string msg, Action action, Action finallyAction) { WrapErr.WrapTryToErrorReportException(code, () => { return(msg); }, action, finallyAction); }
/// <summary> /// Wrap an action to catch and convert exceptions not previously caught and /// converted to ErrReportExceptions. /// </summary> /// <param name="code">The error code</param> /// <param name="msg">The error message</param> /// <param name="action">The action to invoke</param> public static void ToErrorReportException(int code, Action action) { WrapErr.WrapTryToErrorReportException(code, () => { return(REPLACE_WITH_EXCEPTION_MSG); }, action, () => {; }); }