codekingpro/portable-devtools
114k
1# The Python ISAPI package.2 3 4# Exceptions thrown by the DLL framework.5class ISAPIError(Exception):6 def __init__(self, errno, strerror=None, funcname=None):7 # named attributes match IOError etc.8 self.errno = errno9 self.strerror = strerror10 self.funcname = funcname11 Exception.__init__(self, errno, strerror, funcname)12 13 def __str__(self):14 if self.strerror is None:15 try:16 import win32api17 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 25class FilterError(ISAPIError):26 pass27 28 29class ExtensionError(ISAPIError):30 pass31 32 33# A little development aid - a filter or extension callback function can34# 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.38class InternalReloadException(Exception):39 pass40 