Skip to content

Commit

Permalink
Simplify error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Nov 15, 2024
1 parent 9472bb9 commit c0345b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/wxflow/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def _copy_files(filelist, required=True):
try:
cp(src, dest)
logger.info(f'Copied {src} to {dest}')
except Exception as ee:
except Exception:

Check warning on line 87 in src/wxflow/file_utils.py

View check run for this annotation

Codecov / codecov/patch

src/wxflow/file_utils.py#L87

Added line #L87 was not covered by tests
logger.exception(f"Error copying {src} to {dest}")
raise OSError(str(ee), f"\nError copying {src} to {dest}")
raise OSError(f"Error copying {src} to {dest}")

Check warning on line 89 in src/wxflow/file_utils.py

View check run for this annotation

Codecov / codecov/patch

src/wxflow/file_utils.py#L89

Added line #L89 was not covered by tests
else:
if required:
logger.exception(f"Source file '{src}' does not exist and is required, ABORT!")
Expand All @@ -107,6 +107,6 @@ def _make_dirs(dirlist):
try:
mkdir(dd)
logger.info(f'Created {dd}')
except Exception as ee:
except Exception:

Check warning on line 110 in src/wxflow/file_utils.py

View check run for this annotation

Codecov / codecov/patch

src/wxflow/file_utils.py#L110

Added line #L110 was not covered by tests
logger.exception(f"Error creating directory {dd}")
raise OSError(str(ee), f"\nError creating directory {dd}")
raise OSError(f"\nError creating directory {dd}")

Check warning on line 112 in src/wxflow/file_utils.py

View check run for this annotation

Codecov / codecov/patch

src/wxflow/file_utils.py#L112

Added line #L112 was not covered by tests
4 changes: 2 additions & 2 deletions src/wxflow/sqlitedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ def remove_column(self, table_name: str, column_name: str) -> None:
try:
query = f"ALTER TABLE {table_name} DROP COLUMN {column_name}"
self.execute_query(query)
except sqlite3.OperationalError as exc:
except sqlite3.OperationalError:
query = f"PRAGMA table_info({table_name})"
cursor = self.execute_query(query)
columns = [column[1] for column in cursor.fetchall()]
if column_name not in columns:
raise ValueError(f"Column '{column_name}' does not exist in table '{table_name}'")
raise sqlite3.OperationalError(str(exc))
raise sqlite3.OperationalError("An unknown SQL error occurred")

Check warning on line 116 in src/wxflow/sqlitedb.py

View check run for this annotation

Codecov / codecov/patch

src/wxflow/sqlitedb.py#L116

Added line #L116 was not covered by tests

def update_data(
self,
Expand Down

0 comments on commit c0345b1

Please sign in to comment.