Format: text/x-python
⬇ Download File (1.2 KB)
   1  # The Python ISAPI package.
   2  
   3  
   4  # Exceptions thrown by the DLL framework.
   5  class ISAPIError(Exception):
   6      def __init__(self, errno, strerror=None, funcname=None):
   7          # named attributes match OSError etc.
   8          self.errno = errno
   9          self.strerror = strerror
  10          self.funcname = funcname
  11          Exception.__init__(self, errno, strerror, funcname)
  12  
  13      def __str__(self):
  14          if self.strerror is None:
  15              try:
  16                  import win32api
  17  
  18                  self.strerror = win32api.FormatMessage(self.errno).strip()
  19              except:
  20                  self.strerror = "no error message is available"
  21          # str() looks like a win32api error.
  22          return str((self.errno, self.strerror, self.funcname))
  23  
  24  
  25  class FilterError(ISAPIError):
  26      pass
  27  
  28  
  29  class ExtensionError(ISAPIError):
  30      pass
  31  
  32  
  33  # A little development aid - a filter or extension callback function can
  34  # raise one of these exceptions, and the handler module will be reloaded.
  35  # This means you can change your code without restarting IIS.
  36  # After a reload, your filter/extension will have the GetFilterVersion/
  37  # GetExtensionVersion function called, but with None as the first arg.
  38  class InternalReloadException(Exception):
  39      pass
  40