From aa86028ea3c0e59a9241db35de4d1ffbeded199f Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 18 Mar 2024 21:05:56 -0700 Subject: [PATCH] Catch exception on edge case where `downloads` table is not present --- pyhindsight/browsers/chrome.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pyhindsight/browsers/chrome.py b/pyhindsight/browsers/chrome.py index b38d29a..fae5cf8 100644 --- a/pyhindsight/browsers/chrome.py +++ b/pyhindsight/browsers/chrome.py @@ -2,6 +2,7 @@ import hashlib import math import os +import sqlite3 import sys import errno import datetime @@ -484,8 +485,13 @@ def get_downloads(self, path, database, version, row_type): return cursor = conn.cursor() - # Use highest compatible version SQL to select download data - cursor.execute(query[compatible_version]) + # Use the highest compatible version SQL to select download data + try: + cursor.execute(query[compatible_version]) + except sqlite3.OperationalError as e: + log.warning(f' - Exception while executing query; {e}') + self.artifacts_counts[database + '_downloads'] = 'Failed' + return for row in cursor: try: