Due to naming established in QTP, beginners often confuse exceptions and GUI events.
Truly, pop-up window is not an "exception" even if it "crashes" script execution.
For catching and recovery from failed operations, I recommend using "On Error Resume Next...On Error GoTo 0" statements.
For catching GUI events, that may or may not happen, you can use QTP Recovery Scenarios, BUT, as Tom E mentioned, each activated recovery handler uses extra resources and affects QTP performance.
Best way to use only those of them you would need, and keep the rest deactivated.
A few examples.
1.Catching exceptions
This way, if you have RegEx syntax errors, execution won't stop.
Set objRegEx = New RegExp
objRegEx.Pattern = strRegEx
On Error Resume Next
boolRC = objRegEx.Test(strSrc)
intRC = Err.Number
On Error GoTo 0
If intRC <> 0 Then boolRC = False
Set objRegEx = Nothing
2.Dynamically operating Recovery handlers
intPos = Recovery.GetScenarioPosition("API\Exceptions\AppExceptions.qrs", "Recovery_on_Error1")
''# You can store intPos (position in QTP's qrs file) for all handlers during initialization
Recovery.SetScenarioStatus intPos, boolState ''# Parameterize boolState as True or False
''# Enable or disable handlers this way. Disabled handler does not consume QTP resources.
Thank you,
Albert Gareev
http://automation-beyond.com/