From b5d732cfd6e0f2e62ce79739c2520824cf4a6cb9 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sun, 29 Jul 2012 09:45:19 -0500 Subject: [PATCH] Pi: formatting cleanup, show database error --- modules/Pi.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/Pi.py b/modules/Pi.py index e343d12..d8e29c2 100644 --- a/modules/Pi.py +++ b/modules/Pi.py @@ -104,10 +104,15 @@ class Pi(Module): db.rollback() self.log.error("database error doing pi stuff") self.log.exception(e) - return self.reply(connection, event, "database error doing pi stuff") + return self.reply(connection, event, + "database error while estimating pi: {0:s}".format(str(e))) finally: cur.close() - return self.reply(connection, event, "({0:.10f}, {1:.10f}) is {2}within the circle. pi is {5:.10f}. (i:{3:d} p:{4:d})".format(x, y, "" if inside else "not ", count_inside, count, pi)) + return self.reply(connection, event, + "({0:.10f}, {1:.10f}) is {2}within the circle. "\ + "pi is {5:.10f}. (i:{3:d} p:{4:d})".format(x, y, + "" if inside else "not ", + count_inside, count, pi)) # vi:tabstop=4:expandtab:autoindent # kate: indent-mode python;indent-width 4;replace-tabs on;