Handling MTS Catalog Errors

The catalog collection and catalog utility methods return HRESULTS that indicate success or failure. In Visual Basic, you use the On Error handler and the Err object to trap these errors and access the failure code. Methods that deal with many objects (such as the SaveChanges or InstallPackage methods) may capture multiple error codes to describe specific object failures. You access this set of codes through a collection called ErrorInfo. You can use the GetCollection method to access an ErrorInfo collection. Each CatalogCollection object that you instantiate maintains an ErrorInfo collection that stores failure codes for the last method call that failed. If you are installing a package, you can see which components are already installed by accessing the ErrorInfo collection for that object.

It is recommended that you program your application to check each method call for success or failure. Your program should especially test for the E_INVALIDARG return code (run-time error 5 in Visual Basic) when supplying collection names or property names. This code indicates that one or more of the supplied collection or property names is not supported.

See Also

MTS Administration Objects, MTS Collection Types, MTS Administration Object Methods, MTS ErrorInfo Collection