123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using System;
- using System.Web.Services.Protocols;
- using System.Xml;
- using System.Text;
- namespace Exceptions
- {
-
-
-
- public class CognosException
- {
- private SoapException _exception = null;
-
-
-
-
- public CognosException( SoapException ex )
- {
- _exception = ex;
- }
-
-
-
- public string Message {
- get {
- return _exception.Message;
- }
- }
-
-
-
- public string Severity {
- get {
- return _exception.Detail.SelectSingleNode( "//severity" ).InnerText;
- }
- }
-
-
-
- public string ErrorCode {
- get {
- return _exception.Detail.SelectSingleNode( "//errorCode" ).InnerText;
- }
- }
-
-
-
- public string[] Details {
- get {
- XmlNodeList nodes = _exception.Detail.SelectNodes( "//messageString" );
- string[] retval = new string[nodes.Count];
- for( int idx = 0; idx < nodes.Count; idx++ ) {
- retval[idx] = nodes[idx].InnerText;
- }
- return retval;
- }
- }
-
-
-
-
- public override string ToString() {
- StringBuilder str = new StringBuilder();
-
- str.AppendFormat( "Message: {0}\n", Message );
- str.AppendFormat( "Severity: {0}\n", Severity );
- str.AppendFormat( "ErrorCode: {0}\n", ErrorCode );
- str.AppendFormat( "Details:\n" );
- foreach( string s in Details ) {
- str.AppendFormat( "\t{0}\n", s );
- }
- return str.ToString();
- }
-
-
-
-
-
-
-
-
- static public string ConvertToString( SoapException ex ) {
- CognosException exception = new CognosException( ex );
- return exception.ToString();
- }
- }
- }
|