Log json diff line parsing errors. By @real-yfprojects (#1369)

This commit is contained in:
yfprojects 2022-07-03 05:59:33 +00:00 committed by GitHub
parent e53aa966fc
commit 305db92d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import json
import logging
import os
import re
@ -14,6 +15,8 @@ from vorta.views.partials.tree_view import TreeModel
uifile = get_asset('UI/diffresult.ui')
DiffResultUI, DiffResultBase = uic.loadUiType(uifile)
logger = logging.getLogger(__name__)
class DiffResult(DiffResultBase, DiffResultUI):
def __init__(self, fs_data, archive_newer, archive_older, json_lines):
@ -123,6 +126,7 @@ def parse_diff_json_lines(diffs):
if not change_type:
# either no changes, or unrecognized change(s)
logger.error(f"Error parsing diff line {json.dumps(item)}")
raise ValueError(f"Unknown change type {change['type']}")
files_with_attributes.append((size, change_type, name, dirpath, file_type))