There are two ways to do this.
The first is to use Exception Handling, and catch the Exception.
Once that has been done you can use methods like GetBaseException() and test if it was caused by an item not being found. Here is a code example that tries to perform as TransformText on a non-existent RuleGroupName (Lookup table name), but *without* bombing out with an error:
'--------------
Dim strRuleGroupName As String = "E101_Acct_Description"
Dim strResult As String = String.Empty
Dim bTableExists As Boolean
Try
strResult = brapi.Utilities.TransformText(si, "11000", strRuleGroupName, True)
bTableExists = True
Catch ex As XFException
Dim baseException = ex.GetBaseException()
brapi.ErrorLog.LogMessage(si,"Inside exception, ex.Message:" & baseException.Message)
If baseException.Message.Equals(GeneralStrings.ItemWasNotFound) Then
bTableExists = False
Else
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End If
End Try
brapi.ErrorLog.LogMessage(si, "Lookup table " & strRuleGroupName & " exists? : " & bTableExists.ToString() )
'-----------------------------
The example above checks the originating Exception is in fact caused by the lookup table not existing, by comparing with the pre-defined message constant : GeneralStrings.ItemWasNotFound , which would be thrown deep inside one of the internal WCF classes. This way if another type of exception occurred (which has nothing to do with the lookup table not existing) then it would generally throw an error otherwise, which is what you probably want. Basically, when I catch an exceptions never assume the cause of it, hence the test on the BaseException's cause.
And *obviously* take out the LogMessage statements when you are done testing!