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.StackTrace); } return(apiMsg); }
public static async Task <ApiMessage> Wrap(Func <Task> action) { var apiMsg = new ApiMessage(); try { await action(); } catch (Exception exc) { apiMsg.SetFault(exc); } return(apiMsg); }