What are Exceptions?
Exceptions are events that are recognized by the program categorized and handled. An exception is an unwanted event that interrupts the normal flow of the program. when an exception occurs program execution gets terminated in such cases, we get a system generated error message.
There are 2 types of exceptions: -
System Exceptions: -
All exception is type derived from system exception so using this generic type in a Try catch block for example catch all type of errors.
eg NullReferenceException-This exception usually occurs when using a variable with no set value (not initialized).
ArgumentException-Exception is thrown when a method is invoked and at least one of the passed arguments does not meet the parameters specification of the called method.
IndexOutofRangeException-Exception occur when the index of an object is out of the limits of the collection.
These are some examples of System exception.
Business Exceptions: -
Business rule describes error rooted in the certain data which the automation project depends on is incomplete, missing outside of set boundaries These exceptions can be handled through Throw and Rethrow activity where we just can throw the exception as per the requirement.
eg :- Input file are not present
Email not received
Credentials expired.
0 Comments