Files
DP44/Common/DTS.Common.Utilities/ExceptionalForm.cs
2026-04-17 14:55:32 -04:00

87 lines
2.6 KiB
C#

/*
* ExceptionalForm.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DTS.Common.Utilities
{
/// <summary>
/// A Windows-style Form with it's own exception type.
/// </summary>
///
/// <remarks>
/// Sample usage:
/// public class A : ExceptionalForm
/// {
/// public void ScrewItUp( )
/// {
/// private bool error = true;
/// if ( error ) throw new A.Exception( "Class A-specific screwup." );
/// }
/// }
///
/// ...
///
/// try
/// {
/// A.ScrewItUp( );
/// B.ScrewItUp( );
/// C.ScrewItUp( );
/// }
/// catch ( A.Exception ex )
/// {
/// // Can pick A's exceptions out of a crowd, or not and just treat it
/// // polymorphically as a System.Exception.
/// }
/// </remarks>
///
[global::System.Serializable]
public class ExceptionalForm : Form
{
/// <summary>
/// Initialize an instance of the ExceptionForm class.
/// </summary>
public ExceptionalForm()
: base()
{
}
/// <summary>
/// A representation of the DerivedClass.Exception class.
/// </summary>
public class Exception : ApplicationException
{
/// <summary>
/// create a <see cref="ExceptionalForm.Exception" />
/// </summary>
public Exception() { }
/// <summary>
/// create a <see cref="ExceptionalForm.Exception" /> with
/// a description
/// </summary>
/// <param name="msg">Description of error</param>
public Exception(string msg) : base(msg) { }
/// <summary>
/// create a <see cref="ExceptionalForm.Exception" /> with
/// a description and a reference to the exception causing the error
/// </summary>
/// <param name="msg">Description of error</param>
/// <param name="innerEx">exception causing the error</param>
public Exception(string msg, System.Exception innerEx) : base(msg, innerEx) { }
protected Exception(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
}
}