AdsOpenObject always returns a HRESULT which you can check against known values (case hr of). When you declare a function as safecall in Delphi a wrapper (sometimes called an
exception firewall) is added that will raise exceptions for you. If you want you can declare the function as safecall (just replace stdcall with safecall) and use a try..except handler.
PS: the other functions in AdsHlp such as AdsGetObject have the same declaration using WideString so you should change those as well...