Raise `ValueError` in case of unknown change type in diff json. By @real-yfprojects (#1350)

Currently an assert statement checks whether a change type was recognized.
This assert statement won't give any information on the actual change type that
is not implemented. Now a ValueError that mentiones the unknown change type in
its message will be raised instead.

* src/vorta/views/diff_result.py (parse_diff_json_lines): Replace assert statement by
	if and raise statements.

Co-authored-by: real-yfprojects <real-yfprojects@users.noreply.github.com>
This commit is contained in:
yfprojects 2022-06-07 06:32:58 +00:00 committed by GitHub
parent 492a3128f8
commit 091c0dcacd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -120,7 +120,10 @@ def parse_diff_json_lines(diffs):
# change['new_user'], change['new_group'])
change_type = 'modified'
change_type_priority = 1
assert change_type # either no changes, or unrecognized change(s)
if not change_type:
# either no changes, or unrecognized change(s)
raise ValueError(f"Unknown change type {change['type']}")
files_with_attributes.append((size, change_type, name, dirpath, file_type))