def ProcessAXScriptException(scriptingSite, debugManager, exceptionInstance):
 instance = IActiveScriptError()
 instance._SetExceptionInfo(exceptionInstance)
 gateway = win32com.server.util.wrap(instance, axscript.IID_IActiveScriptError)
 if debugManager:
  fCallOnError = debugManager.HandleRuntimeError()
  if (not fCallOnError):
   return None
 try:
  result = scriptingSite.OnScriptError(gateway)
 except pythoncom.com_error as details:
  print '**OnScriptError failed:', details
  print ("Exception description:'%s'" % repr(exceptionInstance.description))
  print ("Exception text:'%s'" % repr(exceptionInstance.linetext))
  result = winerror.S_FALSE
 if (result == winerror.S_OK):
  ret = win32com.server.exception.COMException(scode=axscript.SCRIPT_E_REPORTED)
  return ret
 else:
  return exceptionInstance

def ProcessAXScriptException ( scriptingSite , debugManager , exceptionInstance ) : instance = IActiveScriptError ( ) instance . _SetExceptionInfo ( exceptionInstance ) gateway = win32com . server . util . wrap ( instance , axscript . IID_IActiveScriptError ) if debugManager : fCallOnError = debugManager . HandleRuntimeError ( ) if ( not fCallOnError ) : return None try : result = scriptingSite . OnScriptError ( gateway ) except pythoncom . com_error as details : print '**OnScriptError failed:' , details print ( "Exception description:'%s'" % repr ( exceptionInstance . description ) ) print ( "Exception text:'%s'" % repr ( exceptionInstance . linetext ) ) result = winerror . S_FALSE if ( result == winerror . S_OK ) : ret = win32com . server . exception . COMException ( scode = axscript . SCRIPT_E_REPORTED ) return ret else : return exceptionInstance
general function to handle any exception in ax code this function creates an instance of our iactivescripterror interface .