diff options
author | olly <olly@ollycope.com> | 2015-04-15 08:41:21 +0000 |
---|---|---|
committer | olly <olly@ollycope.com> | 2015-04-15 08:41:21 +0000 |
commit | c30f8194d03850001bedefbbc3cad59d8188544d (patch) | |
tree | ba8be16276c33b50be9548adff6da64c776cde87 | |
parent | c76906feea6e42858e9cf99d499f4a3ffd5112ba (diff) | |
download | yoyo-c30f8194d03850001bedefbbc3cad59d8188544d.tar.gz |
Import the exceptions module rather than individual symbols
-rwxr-xr-x | yoyo/migrations.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/yoyo/migrations.py b/yoyo/migrations.py index a1d2fe3..ffd7491 100755 --- a/yoyo/migrations.py +++ b/yoyo/migrations.py @@ -6,7 +6,7 @@ import sys import inspect from yoyo.compat import reraise, exec_, ustr -from yoyo.exceptions import DatabaseError +from yoyo import exceptions from yoyo.utils import plural logger = getLogger(__name__) @@ -83,13 +83,13 @@ class Migration(object): try: getattr(step, direction)(conn, paramstyle, force) executed_steps.append(step) - except DatabaseError: + except exceptions.DatabaseError: conn.rollback() exc_info = sys.exc_info() try: for step in reversed(executed_steps): getattr(step, reverse)(conn, paramstyle) - except DatabaseError: + except exceptions.DatabaseError: logger.exception( 'Database error when reversing %s of step', direction) reraise(exc_info[0], exc_info[1], exc_info[2]) @@ -148,7 +148,7 @@ class Transaction(StepBase): for step in self.steps: try: step.apply(conn, paramstyle, force) - except DatabaseError: + except exceptions.DatabaseError: conn.rollback() if force or self.ignore_errors in ('apply', 'all'): logger.exception("Ignored error in step %d", step.id) @@ -160,7 +160,7 @@ class Transaction(StepBase): for step in reversed(self.steps): try: step.rollback(conn, paramstyle, force) - except DatabaseError: + except exceptions.DatabaseError: conn.rollback() if force or self.ignore_errors in ('rollback', 'all'): logger.exception("Ignored error in step %d", step.id) @@ -394,7 +394,7 @@ def create_migrations_table(conn, tablename): ctime TIMESTAMP) """ % (tablename,)) conn.commit() - except DatabaseError: + except exceptions.DatabaseError: pass finally: cursor.close() |