public SilentAction(string type, object position, Action<ISpecContext> action, Node node) { if (node.id.IsEmpty()) { throw new ArgumentOutOfRangeException("node", "The node must have an id"); } Position = position; _type = type; _action = action; _node = node; Subject = position.ToString(); }
public static SilentAction AsCritical(string type, object position, Action<ISpecContext> action, Node node) { Action<ISpecContext> wrapped = c => { try { action(c); } catch (StorytellerCriticalException) { throw; } catch (StorytellerCatastrophicException) { throw; } catch (Exception e) { throw new StorytellerCriticalException("Failed at position '{0}'".ToFormat(position), e); } }; return new SilentAction(type, position, wrapped, node); }