|
24 | 24 |
|
25 | 25 | from core.models import AWSKey, PacuSession
|
26 | 26 | from setup_database import setup_database_if_not_present
|
| 27 | + from sqlalchemy import exc |
27 | 28 | from utils import get_database_connection, set_sigint_handler
|
28 | 29 | except ModuleNotFoundError as error:
|
29 | 30 | exception_type, exception_value, tb = sys.exc_info()
|
@@ -813,7 +814,6 @@ def export_keys(self, command):
|
813 | 814 | else:
|
814 | 815 | return
|
815 | 816 |
|
816 |
| - |
817 | 817 | ###### Some module notes
|
818 | 818 | # For any argument that needs a value and a region for that value, use the form
|
819 | 819 | # value@region
|
@@ -1577,6 +1577,19 @@ def run_gui(self):
|
1577 | 1577 | local_data=local_data,
|
1578 | 1578 | global_data=global_data
|
1579 | 1579 | )
|
| 1580 | + |
| 1581 | + # Catch sqlalchemy error |
| 1582 | + elif exception_type == exc.OperationalError: |
| 1583 | + traceback_text = '\nTraceback (most recent call last):\n{}{}: {}\n\n'.format(''.join(traceback.format_tb(tb)), str(exception_type), str(exception_value)) |
| 1584 | + session, global_data, local_data = self.get_data_from_traceback(tb) |
| 1585 | + self.log_error( |
| 1586 | + traceback_text, |
| 1587 | + exception_info='{}: {}\n\nPacu database error. This could be caused by a recent update in Pacu\'s database\'s structure. If your Pacu has been updated recently, try removing your old db.sqlite3 database file.'.format(exception_type, exception_value), |
| 1588 | + session=session, |
| 1589 | + local_data=local_data, |
| 1590 | + global_data=global_data |
| 1591 | + ) |
| 1592 | + |
1580 | 1593 | else:
|
1581 | 1594 | traceback_text = '\nTraceback (most recent call last):\n{}{}: {}\n\n'.format(''.join(traceback.format_tb(tb)), str(exception_type), str(exception_value))
|
1582 | 1595 | session, global_data, local_data = self.get_data_from_traceback(tb)
|
|
0 commit comments