public void subErrorHandlerInitialization(ref ErrorHandler.ErrorHandler objErrorHandlerIn) { //===================================================================== // Procedure Name : gsubErrorHandlerInitialization // Parameters Passed : Global Object of Error HAndler // Returns : None // Purpose : To initialize error handling object // Description : // Assumptions : // Dependencies : // Author : Mangesh Shardul // Created : 14 sept 2004 11:30 am // Revisions : //===================================================================== try { if (IsNothing(gobjErrorHandler) == true) { gobjErrorHandler = new ErrorHandler.ErrorHandler(); } objErrorHandlerIn.CompanyName = Application.ProductName; objErrorHandlerIn.ErrorLogFolder = "ErrorLogs"; objErrorHandlerIn.ErrorLogFileName = Application.StartupPath + "\\" + objErrorHandlerIn.ErrorLogFolder + "\\ErrorLog-" + DateAndTime.DateString + "-" + DateAndTime.Hour(Now) + "-" + DateAndTime.Minute(Now) + "-" + DateAndTime.Second(Now) + ".log"; objErrorHandlerIn.VersionMajor = Application.ProductVersion; objErrorHandlerIn.ProductName = Application.ProductName; objErrorHandlerIn.ExecutionTrailFolder = "ExecutionLogs"; objErrorHandlerIn.ExecutionLogFileName = Application.StartupPath + "\\" + objErrorHandlerIn.ExecutionTrailFolder + "\\ExecutionLog-" + DateAndTime.DateString + "-" + DateAndTime.Hour(Now) + "-" + DateAndTime.Minute(Now) + "-" + DateAndTime.Second(Now) + ".log"; //--- Check for the folders if not create the folders if (!Directory.Exists(Application.StartupPath + "\\" + objErrorHandlerIn.ErrorLogFolder)) { //--- Create the folder Directory.CreateDirectory(Application.StartupPath + "\\" + objErrorHandlerIn.ErrorLogFolder); } if (!Directory.Exists(Application.StartupPath + "\\" + objErrorHandlerIn.ExecutionTrailFolder)) { //--- Create the folder Directory.CreateDirectory(Application.StartupPath + "\\" + objErrorHandlerIn.ExecutionTrailFolder); } } catch (Exception ex) { //--------------------------------------------------------- //Error Handling and logging gobjErrorHandler.ErrorDescription = ex.Message; gobjErrorHandler.ErrorMessage = ex.Message; gobjErrorHandler.WriteErrorLog(ex); //--------------------------------------------------------- } finally { //--------------------------------------------------------- //Writing Execution log if (CONST_CREATE_EXECUTION_LOG == 1) { gobjErrorHandler.WriteExecutionLog(); } //--------------------------------------------------------- } }
public void When_DoSomeWorkCalled_Then_ExceptionShouldBeCatched() { var errorHandler = new ErrorHandler(); errorHandler.DoSomething(); Assert.Pass(); }
public void When_DoSomethingCalled_Then_FinallyBlockShouldExecute() { var errorHandler = new ErrorHandler(); string exceptionMessage = errorHandler.DoSomething(); Assert.That(exceptionMessage.Contains("finally")); }
public void When_WeHaveTwoTryCatchBlockThePriorityIsByInnerBlock() { var errorHandler=new ErrorHandler(); errorHandler.DoSomethingMore(); Assert.Pass(); }
public void When_RaiseException_ThePriorityIsForTopOneThatMatches() { var errorHandler = new ErrorHandler(); string exceptionMessage = errorHandler.DoSomething(); Assert.That(exceptionMessage.Contains("argument exception")); }
public void When_RaiseExceptionCalled_Then_anExceptionShouldbeRaise() { var errorHandler=new ErrorHandler(); try { errorHandler.RaiseException(); } catch (Exception ex) { Assert.That("This is RaiseException exception", Is.EqualTo(ex.Message)); } }
public DALDB(string _connString) { connString = _connString; err = new ErrorHandler.ErrorHandler(); }