/**
Licensed Materials - Property of IBM
IBM Cognos Products: DOCS
(C) Copyright IBM Corp. 2005, 2008
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
IBM Corp.
*/
// Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
// Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
using System;
using System.Web.Services.Protocols;
using System.Text;
using cognosdotnet_10_2;
using System.Xml;
using System.Windows.Forms;
namespace SamplesCommon
{
///
/// Display a simple dialog box reporting an error to the user.
///
public class SamplesException
{
///
/// You can't make this, just call the static method.
///
private SamplesException()
{
}
///
/// Turn a SoapException into a string suitable for display to a user.
///
/// A SoapException object.
/// A string representation of the exception.
public static string FormatException( SoapException ex ) {
return ExceptionHelper.ConvertToString( ex );
}
///
/// Display a SOAP exception in a simple dialog box.
///
/// The exception object.
/// True if we should display a GUI, false if we shouldn't.
public static void ShowExceptionMessage( SoapException ex, bool gui, string title )
{
string error = ExceptionHelper.ConvertToString( ex );
if( gui )
{
MessageBox.Show( error, title, MessageBoxButtons.OK, MessageBoxIcon.Error );
} else
{
Console.WriteLine( error );
}
}
public static string getExceptionMessage( SoapException ex)
{
return ExceptionHelper.ConvertToString( ex );
}
public static void ShowExceptionMessage( string error, bool gui, string title )
{
if( gui )
{
MessageBox.Show( error, title, MessageBoxButtons.OK, MessageBoxIcon.Error );
}
else
{
Console.WriteLine( error );
}
}
}
}