def _get_one(self, name): try: item = interfaceInfoManager.GetInfoForName(name) except xpcom.COMException, why: # Present a better exception message, and give a more useful error code. import nsError raise xpcom.COMException(nsError.NS_ERROR_NO_INTERFACE, "The interface '%s' does not exist" % (name,))
def createInstance(self, iid = None): import xpcom.client try: return xpcom.client.Component(self.contractid, _get_good_iid(iid)) except xpcom.COMException as details: from . import nsError # Handle "no such component" in a cleaner way for the user. if details.errno == nsError.NS_ERROR_FACTORY_NOT_REGISTERED: raise xpcom.COMException(details.errno, "No such component '%s'" % (self.contractid,)) raise # Any other exception reraise.
# The contents of this file are subject to the Mozilla Public License Version