Commit c6948a6d authored by Naoki Kambe's avatar Naoki Kambe
Browse files

[trac930] raise StatsError including errors in the stats spec file

parent db0371fc
......@@ -165,7 +165,8 @@ class Stats:
boot_time=get_datetime(_BASETIME)
)
if errors:
raise StatsError("stats spec file is incorrect")
raise StatsError("stats spec file is incorrect: "
+ ", ".join(errors))
while self.running:
self.mccs.check_command(False)
......@@ -293,7 +294,9 @@ class Stats:
timestamp=get_timestamp(),
report_time=get_datetime()
)
if errors: raise StatsError("stats spec file is incorrect")
if errors:
raise StatsError("stats spec file is incorrect: "
+ ", ".join(errors))
ret = self.get_statistics_data(owner, name)
if ret is not None:
return isc.config.create_answer(0, ret)
......@@ -352,7 +355,8 @@ class Stats:
errors = self.update_statistics_data(
self.module_name, last_update_time=get_datetime() )
if errors:
raise StatsError("stats spec file is incorrect")
raise StatsError("stats spec file is incorrect: "
+ ", ".join(errors))
return isc.config.create_answer(0)
if __name__ == "__main__":
......
......@@ -191,7 +191,7 @@ class TestStats(unittest.TestCase):
def test_start_with_err(self):
statsd = stats.Stats()
statsd.update_statistics_data = lambda x,**y: [1]
statsd.update_statistics_data = lambda x,**y: ['an error']
self.assertRaises(stats.StatsError, statsd.start)
def test_config_handler(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment