66import winerror
77from win32com .axdebug import codecontainer , gateways
88from win32com .axdebug .util import _wrap , trace
9- from win32com .server .exception import Exception
9+ from win32com .server .exception import COMException
1010
1111
1212class ExternalConnection :
@@ -57,7 +57,7 @@ def _GetCodeContainer(self):
5757 try :
5858 codeText = open (self .module .__file__ , "rt" ).read ()
5959 except OSError as details :
60- codeText = f"# Exception opening file\n # { details } "
60+ codeText = f"# COMException opening file\n # { details } "
6161
6262 self .codeContainer = codecontainer .SourceCodeContainer (
6363 codeText , self .module .__file__
@@ -79,23 +79,23 @@ def GetDeferredText(self, dwTextStartCookie, maxChars, bWantAttr):
7979 def GetScriptTextAttributes (self , codeText , delimterText , flags ):
8080 # Result must be an attribute sequence of same "length" as the code.
8181 trace ("GetScriptTextAttributes" , delimterText , flags )
82- raise Exception (scode = winerror .E_NOTIMPL )
82+ raise COMException (scode = winerror .E_NOTIMPL )
8383
8484 def OnCreateDocumentContext (self ):
8585 # Result must be a PyIUnknown
8686 trace ("OnCreateDocumentContext" )
87- raise Exception (scode = winerror .E_NOTIMPL )
87+ raise COMException (scode = winerror .E_NOTIMPL )
8888
8989 def GetPathName (self ):
9090 # Result must be (string, int) where the int is a BOOL
9191 # - TRUE if the path refers to the original file for the document.
9292 # - FALSE if the path refers to a newly created temporary file.
93- # - raise Exception (scode=E_FAIL) if no source file can be created/determined.
93+ # - raise COMException (scode=E_FAIL) if no source file can be created/determined.
9494 trace ("GetPathName" )
9595 try :
9696 return win32api .GetFullPathName (self .module .__file__ ), 1
9797 except (AttributeError , win32api .error ):
98- raise Exception (scode = winerror .E_FAIL )
98+ raise COMException (scode = winerror .E_FAIL )
9999
100100 def GetFileName (self ):
101101 # Result is a string with just the name of the document, no path information.
@@ -104,7 +104,7 @@ def GetFileName(self):
104104
105105 def NotifyChanged ():
106106 trace ("NotifyChanged" )
107- raise Exception (scode = winerror .E_NOTIMPL )
107+ raise COMException (scode = winerror .E_NOTIMPL )
108108
109109
110110def TestSmartProvider ():
0 commit comments