protected void CheckRights(ScenarioActionSource source, ExecutionContext context) { try { if (!IsAccessAvailable(source)) { throw new ScenarioExecutionException(ScenarioExecutionError.AccessDenied); } } catch (Exception e) { context?.CancelAll(); //stop execution throw e; } }
protected void CheckValue(string param, ExecutionContext parentContext) { try { if (!ValueType.Interprete(param).Success) { throw new ScenarioExecutionException(ScenarioExecutionError.InvalidValue, param); } } catch (Exception e) { parentContext?.CancelAll(); //stop execution throw e; } }
protected void CheckContext(ExecutionContext context) { try { if (context.Find((x) => x.AlgorithmContext is ScenarioBase scenarioBase && scenarioBase.Id == Id) != null) //if true - then it is circular reference { throw new ScenarioExecutionException(ScenarioExecutionError.CircularReference); } if (context.ExecutionNesting >= MaxStackValue) { throw new ScenarioExecutionException(ScenarioExecutionError.StackOverflow); } } catch (Exception e) { context?.CancelAll(); //stop execution throw e; } }