In script, when I'm checking whether an object is exist or not in a conditional statement, if the object doesn't exist, it puts an error message to the log automatically making the whole test fail even if the test passed.

The sample code is specified below

If <objectToFind>.Exists Then
Log.Message "Passed"
Log.Message "Failed"
The log report for the above code is

Error : The object does not exist. See Additional Information for details.
Message : Passed

It makes the test fail. but as per the code, it should display the message only.
Can anybody suggest any workaround to avoid such issue.