[docs]classRattailError(Exception):""" Base class for all Rattail exceptions. """
classConfigurationError(RattailError):""" Generic class for configuration errors. """classSQLAlchemyNotInstalled(RattailError):""" Error raised when an operation is requested which requires SQLAlchemy (and/or related libraries) to be installed, but they are not available. """def__init__(self,error):self.error=errordef__str__(self):return("Hm, looks like SQLAlchemy may not be installed? ""(Perhaps you should do: 'pip install rattail[db]'?) ""Original error was: {}".format(self.error))classWindowsExtensionsNotInstalled(RattailError):""" Error raised when an operation is requested which requires the "Python for Windows Extensions" to be instealled, but it is not available. """def__str__(self):return("Cannot proceed because Python for Windows Extensions is not installed. Please see ""https://rattailproject.org/moin/Installation/Windows/Python#Python_for_Windows_Extensions ""for more info.")classMailTemplateNotFound(ConfigurationError):def__init__(self,key):self.key=keydef__str__(self):return("No message templates could be found for '{0}' emails. Please ""create '{0}.(txt|html).mako' and place it/them in one of the ""configured template folders.".format(self.key))classSenderNotFound(ConfigurationError):def__init__(self,key):self.key=keydef__str__(self):return("No email sender (From: address) found in config. Please set '{}.from' ""(or 'default.from') in the [rattail.mail] section.".format(self.key))classRecipientsNotFound(ConfigurationError):def__init__(self,key):self.key=keydef__str__(self):return("No recipients found in config for '{0}' emails. Please set '{0}.to' ""(or 'default.to') in the [rattail.mail] section.".format(self.key))classFileOperationError(RattailError):""" Generic exception for file operation failures. """classPathNotFound(FileOperationError):""" Raised when "path not found" errors are encountered within the :func:`rattail.files.locking_copy_test()` function. The purpose of this is to normalize these errors to a single type, since the file monitor retry mechanism will fail if two distinct exceptions are encountered during its processing attempts. """def__init__(self,original_error):self.original_error=original_errordef__str__(self):return'{}: {}'.format(self.original_error.__class__.__name__,self.original_error)classBatchAlreadyExecuted(RattailError):def__init__(self,batch):self.batch=batchdef__str__(self):return"Batch is already executed: {}".format(self.batch)classLabelPrintingError(Exception):passclassPalmError(RattailError):""" Base class for all errors relating to the Palm OS application interface. """classPalmClassicDatabaseTypelibNotFound(PalmError):def__str__(self):return("The Python module for the Palm Classic Database type library ""could not be generated. (Is the HotSync Manager software ""installed?)")classPalmConduitManagerNotFound(PalmError):def__str__(self):return("The Palm Desktop Conduit Manager could not be instantiated. ""(Is the HotSync Manager software installed?)")classPalmConduitAlreadyRegistered(PalmError):def__str__(self):return"The Rattail Palm conduit is already registered."classPalmConduitNotRegistered(PalmError):def__str__(self):return"The Rattail Palm conduit is not registered."classStopProcessing(RattailError):""" Simple exception to indicate action processing should stop. This is probably only useful for tests. """