Building the Right Environment to Support AI, Machine Learning and Deep Learning

There are cases in which we want to ignore errors even if they are genuine. For example, there could be a feed running on all days except for some fixed holidays. You could work with the as shown below.

The following code catches the null reference exception only when it is not a pre-defined holiday (through the IsHoliday method).

try

{

//code

}

catch(System.NullReferenceException ex) if (!IsHoliday(DateTime.Now))

{

//log this error

}



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here