static Exception WrapException(Exception ex, XmlNodeContext context) => XmlNodeException.Wrap(ex, context.Node);
static Exception WrapException(Exception ex, XmlNode node) => XmlNodeException.Wrap(ex, node);
internal void Execute(XmlElementContext context, string argumentString) { Debug.Assert(_context == null && ArgumentString == null, "Don't call Execute recursively"); Debug.Assert(_logger == null, "Logger wasn't released from previous execution"); if (_context == null && ArgumentString == null) { var error = false; var startedSection = false; try { _context = context; ArgumentString = argumentString; _arguments = null; if (ShouldExecuteTransform()) { startedSection = true; Log.StartSection(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformBeginExecutingMessage, TransformNameLong); Log.LogMessage(MessageType.Verbose, SR.XMLTRANSFORMATION_TransformStatusXPath, context.XPath); if (ApplyTransformToAllTargetNodes) { ApplyOnAllTargetNodes(); } else { ApplyOnce(); } } } catch (Exception ex) { error = true; Log.LogErrorFromException(context.TransformAttribute != null ? XmlNodeException.Wrap(ex, context.TransformAttribute) : ex); } finally { if (startedSection) { Log.EndSection(MessageType.Verbose, error ? SR.XMLTRANSFORMATION_TransformErrorExecutingMessage : SR.XMLTRANSFORMATION_TransformEndExecutingMessage, TransformNameShort); } else { Log.LogMessage(MessageType.Normal, SR.XMLTRANSFORMATION_TransformNotExecutingMessage, TransformNameLong); } _context = null; ArgumentString = null; _arguments = null; ReleaseLogger(); } } }
Exception WrapException(Exception ex) => XmlNodeException.Wrap(ex, Element);