This feature helps to filter the exception messages by providing conditional statements which returns true or false at catch block.
Suppose, if you want to log the exception in catch block only if inner exception is not null. In that scenario, you can write the code like the below.
So, In the catch block
if condition returns true then it enters into the catch block and it would log and throws the exception.
- try
- {
-
- }
- catch(Exception ex) if(ex.InnerException != null)
- {
-
- throw;
- }
- finally
- {
- }