Rapid Agile Development for Prototyping and Rapid Application Development

Navigation: <Root level>

Custom Error Manager

 

 

 

 

Custom Error Manager

 

 

The Custom Error Manager is new in Version 5.0 of kiss!®. Relevant Templates have been updated to include the following Exception handling:

 

C#

 

catch (System.Exception ex)

{

          CustomErrorDOManager.Instance().LogException(this.GetType().ToString(), new StackTrace().GetFrame(0).GetMethod().ToString(), ex, DateTime.Now, CustomErrorDOManager.CONST_SAVE_TO_FILE);

}

 

VB.NET

 

Catch ex As System.Exception

          CustomErrorDOManager.Instance().LogException(Me.GetType().ToString(), New StackTrace().GetFrame(0).GetMethod().ToString(), ex, DateTime.Now, CustomErrorDOManager.CONST_SAVE_TO_FILE)

End Try

 

 

Usage

 

If a System.Exception is generated, CustomErrorDOManager.Instance().LogException is called passing the following parameters:

 

public bool LogException(string errorSourceClass, string errorSourceMethod, System.Exception exception, DateTime errorDateTime, bool saveToFile)

 

errorSourceClass: The name of the Class raising the Exception.

errorSourceMethod: The name of the Method raising the Exception.

exception: The System.Exeption raised for capturing Exception messages.

errorDateTime: The Date and Time of Exception.

saveToFile: Instructs CustomErrorDOManager.Instance().LogException to Save to File, default = false. Changing CustomErrorDOManager.CONST_SAVE_TO_FILE to true and recompiling the CustomErrors project will cause all exceptions to be written to a Daily .log file in the directory of the Execution Assembly (use with caution). Ensure the Executing Assembly has Write access to the directory in which it is located.

 

CustomErrorDO objects are held in memory until cleared programmatically (CustomErrorDOManager.Instance().Clear()) or the application is restarted.

 

Call CustomErrorDOManager.Instance().GetLastError() to get the Last Error raised in the current session:

 

          CustomErrorDO customErrorDO = CustomErrorDOManager.Instance().GetLastError();

 

 

Location

 

Both the CustomErrors.dll Assembly and it's Source Code are supplied under the kiss!® installation directory in the CustomErrors sub-directory:

 

 

 

 

Either add a Reference to the CustomErrors.dll Assembly to the relevant Visual Studio Projects or add a new C# Class Library to the Solution and add CustomErrorVO.cs, CustomErrorDO.cs and CustomErrorDOManager.cs to the new Class Library. This will also work for VB.NET Solutions (C# and VB.NET class libraries can co-exist in the same Visual Studio Solution).

 

 

 

 

Properties and Methods

 

The following Public Properties & Methods are available to call on CustomErrorDOmanager.Instance()

 

 

 

 

 

 

www.rapidagiledevelopment.com by Cove Bay Software Limited Copyright © 2015