Example #1
0
        public static async Task <ApiMessage> Wrap <T>(Func <Task <T> > func)
        {
            var apiMsg = new ApiMessage();

            try
            {
                apiMsg.Data = await func();
            }
            catch (Exception exc)
            {
                apiMsg.SetFault(exc);
            }
            return(apiMsg);
        }
Example #2
0
        public static async Task <ApiMessage> Wrap(Func <Task> action)
        {
            var apiMsg = new ApiMessage();

            try
            {
                await action();
            }
            catch (Exception exc)
            {
                apiMsg.SetFault(exc);
            }

            return(apiMsg);
        }