diff --git a/torndb.py b/torndb.py index 2e0078e..2f53cb4 100644 --- a/torndb.py +++ b/torndb.py @@ -44,6 +44,15 @@ version = "0.3" version_info = (0, 3, 0, 0) + +class TornDbException(Exception): + """Base class for torndb specific exceptions""" + + +class MultipleRowsReturned(TornDbException): + pass + + class Connection(object): """A lightweight wrapper around MySQLdb DB-API connections. @@ -152,7 +161,7 @@ def get(self, query, *parameters, **kwparameters): if not rows: return None elif len(rows) > 1: - raise Exception("Multiple rows returned for Database.get() query") + raise MultipleRowsReturned("Multiple rows returned for Database.get() query") else: return rows[0]