protected async Task <BaseResponse <T> > ExecuteInMonitoring <T>(Func <Task <T> > function) { dynamic result; try { result = await function(); } catch (BaseException ex) { var err = new Dictionary <string, IEnumerable <string> > { { "General", new List <string> { ex.Message } } }; return(BaseResponse <T> .GetErrorResponse(err)); } catch (Exception ex) { var err = new Dictionary <string, IEnumerable <string> > { { "General", new List <string> { ex.ToString() } } }; return(BaseResponse <T> .GetErrorResponse(err)); } return(BaseResponse <T> .GetSuccessResponse(result)); }
protected dynamic ExecuteInMonitoring(Func <dynamic> function) { dynamic result; try { result = function(); }catch (NowVNException ex) { return(BaseResponse.GetErrorResponse(ex.Message)); } return(BaseResponse.GetSuccessResponse(result)); }