__init__.py 1.2 KB

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