@capture_logging(lambda self, logger:
                     self.assertEqual(
                         len(logger.flushTracebacks(CustomException)), 1))
    def test_unexpected_error_reporting(self, logger):
        def error():
            raise CustomException("I've made a terrible mistake")
        self.patch(self.flocker_client, "list_datasets_configuration",
                   error)
        return self.assertResult(
            b"POST", b"/VolumeDriver.Path",
            {u"Name": u"whatever"}, OK,
            {u"Err": "CustomException: I've made a terrible mistake"})
If an unexpected error occurs Docker gets back a useful error message.
dataset/ETHPy150Open ClusterHQ/flocker/flocker/dockerplugin/test/test_api.py/APITestsMixin.test_unexpected_error_reporting