import logging as log
 
+class ConfigError(Exception):
+    """
+    An exception thrown when something is wrong with the config.
+    This is not thrown by the config module, but it is meant to be
+    thrown by handlers when they find something wrong with the
+    configuration contents.
+    """
+    pass
+
 def get_global_config(opts):
     """
     Returns the global configuration, in a SafeConfigParser object.
 
 
 """ Action superclass with common functionality """
 
-import sys
+import sys, ConfigParser
 import logging as log
 
 from backupninja import config
         """
         self.conf = config.load_config(filename, self.default_config)
 
-        
+    def get_config_optional(self, section, option):
+        """
+        Returns the value of the given option. If the option was not set
+        (and no default was set in self.default_config), return None.
+
+        This is a convenience wrapper for ConfigParser.get(), since that
+        throws an exception on unset options.
+        """
+        try:
+            return self.conf.get(section, option)
+        except ConfigParser.NoOptionError:
+            return None
+
+    def get_config_mandatory(self, section, option):
+        """
+        Returns the value of the given option. If the option was not set
+        (and no default was set in self.default_config), raises a
+        backupninja.config.ConfigError.
+
+        This is a convenience wrapper for ConfigParser.get(), since that
+        has a very generic exception message on unknown options.
+        """
+        try:
+            return self.conf.get(section, option)
+        except ConfigParser.NoOptionError:
+            raise config.ConfigError("Option '%s' in section '%s' is mandatory, please configure it" % (option, section))
 
 def create_action(ty):
     """