public ExecutionResult ExecuteMethod(GaugeMethod gaugeMethod, params string[] args) { var method = MethodMap[gaugeMethod.Name]; var executionResult = new ExecutionResult { Success = true }; var logger = LogManager.GetLogger("Sandbox"); try { var parameters = args.Select(o => { try { return(GetTable(o)); } catch { return(o); } }).ToArray(); logger.Debug("Executing method: {0}", method.Name); Execute(method, StringParamConverter.TryConvertParams(method, parameters)); } catch (Exception ex) { logger.Debug("Error executing {0}", method.Name); var innerException = ex.InnerException ?? ex; executionResult.ExceptionMessage = innerException.Message; executionResult.StackTrace = innerException is AggregateException ? innerException.ToString() : innerException.StackTrace; executionResult.Source = innerException.Source; executionResult.Success = false; executionResult.Recoverable = gaugeMethod.ContinueOnFailure; } return(executionResult); }
public ExecutionResult Execute(GaugeMethod gaugeMethod, params string[] args) { { var method = gaugeMethod.MethodInfo; var executionResult = new ExecutionResult(); try { var parameters = args.Select(o => { try { return(GetTable(o)); } catch { return(o); } }).ToArray(); Logger.Debug($"Executing method: {gaugeMethod.Name}"); Execute(method, StringParamConverter.TryConvertParams(method, parameters)); executionResult.Success = true; } catch (Exception ex) { Logger.Debug($"Error executing {method.Name} : {ex.Message}"); var innerException = ex.InnerException ?? ex; executionResult.ExceptionMessage = innerException.Message; executionResult.StackTrace = innerException is AggregateException ? innerException.ToString() : innerException.StackTrace; executionResult.Source = innerException.Source; executionResult.Recoverable = gaugeMethod.ContinueOnFailure; } return(executionResult); } }