// Copyright ? Microsoft Corporation.
// This source file is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.
using System;
using System.Text;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
using System.Diagnostics;
using System.Collections.Generic;
namespace Microsoft.Ddue.Tools {
public static class BuildComponentUtilities {
// get the message strings from an exception
public static string GetExceptionMessage (Exception e) {
if (e == null) throw new ArgumentNullException("e");
string message = e.Message;
XmlException xmlE = e as XmlException;
if (xmlE != null) {
message = String.Format("{0} (LineNumber: {1}; LinePosition: {2}; SourceUri: '{3}')", message, xmlE.LineNumber, xmlE.LinePosition, xmlE.SourceUri);
}
XsltException xslE = e as XsltException;
if (xslE != null) {
message = String.Format("{0} (LineNumber: {1}; LinePosition: {2}; SourceUri: '{3}')", message, xslE.LineNumber, xslE.LinePosition, xslE.SourceUri);
}
if (e.InnerException != null) message = String.Format("{0} {1}", message, GetExceptionMessage(e.InnerException));
return (message);
}
}
}