Update exceptions
This commit is contained in:
parent
25a72b3002
commit
6912758a44
1 changed files with 4 additions and 2 deletions
|
@ -1,14 +1,15 @@
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import traceback
|
||||||
import os
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
|
|
||||||
class DBNotFoundError(Exception):
|
class DBNotFoundError(Exception):
|
||||||
pass
|
'''Could not find the database location'''
|
||||||
|
|
||||||
class InvalidMigrationError(Exception):
|
class InvalidMigrationError(Exception):
|
||||||
pass
|
'''Migration file has an invalid name'''
|
||||||
|
|
||||||
def get_migrations() -> List[Tuple[int, str]] | InvalidMigrationError:
|
def get_migrations() -> List[Tuple[int, str]] | InvalidMigrationError:
|
||||||
'''Returns a list of migration files in numeric order.'''
|
'''Returns a list of migration files in numeric order.'''
|
||||||
|
@ -91,6 +92,7 @@ def main():
|
||||||
conn.commit()
|
conn.commit()
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print(f'An error occurred while applying migration: {ex}, aborting...')
|
print(f'An error occurred while applying migration: {ex}, aborting...')
|
||||||
|
print(traceback.format_exc())
|
||||||
conn.rollback()
|
conn.rollback()
|
||||||
break
|
break
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue