From e4169e84981a5f0cdc3c1c4ed9e9d5230f050f9e 2015-08-16 19:30:00 From: Lance Edgar Date: 2015-08-16 19:30:00 Subject: [PATCH] Add custom errors for when SA / Python for Windows Extensions not installed. --- diff --git a/rattail/exceptions.py b/rattail/exceptions.py index ab045316b57e58fa65c623ba1158206fe9a59710..63c95be1149c298efae5faf4508a38b2e245867c 100644 --- a/rattail/exceptions.py +++ b/rattail/exceptions.py @@ -41,6 +41,32 @@ class ConfigurationError(RattailError): """ +class SQLAlchemyNotInstalled(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 = error + + def __unicode__(self): + return ("Hm, looks like SQLAlchemy may not be installed? " + "(Perhaps you should do: 'pip install rattail[db]'?) " + "Original error was: {0}".format(self.error)) + + +class WindowsExtensionsNotInstalled(RattailError): + """ + Error raised when an operation is requested which requires the "Python for + Windows Extensions" to be instealled, but it is not available. + """ + + def __unicode__(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.") + + class SenderNotFound(ConfigurationError): def __init__(self, key):