d_dimalanta
14 years agoOccasional Contributor
Catching Errors
Hello,
I have a winform object that I try assigning to a var.
Now this object may or may not exist.
When the object does not exist and is being assigned to a var, the test stops executing
and an error "Unable to find the object..." is produced in the log.
This is suitable in certain test cases. However, there are cases where
I don't need the whole test to stop executing because a certain winform cannot be found
(and where a warning may / or may not be needed).
I tried putting the assignment in a try / catch block as seen below, however it seems that a variable assignment error isn't handled the same way as exceptions.
try
{
btn_forgotPass = passW.WinFormsObject("_btnForgotPassword");
}
catch(e){
btn_forgotPass == null;
}
Any suggestions?
thanks,
Daryl
I have a winform object that I try assigning to a var.
Now this object may or may not exist.
When the object does not exist and is being assigned to a var, the test stops executing
and an error "Unable to find the object..." is produced in the log.
This is suitable in certain test cases. However, there are cases where
I don't need the whole test to stop executing because a certain winform cannot be found
(and where a warning may / or may not be needed).
I tried putting the assignment in a try / catch block as seen below, however it seems that a variable assignment error isn't handled the same way as exceptions.
try
{
btn_forgotPass = passW.WinFormsObject("_btnForgotPassword");
}
catch(e){
btn_forgotPass == null;
}
Any suggestions?
thanks,
Daryl