Better error message for an assertion

In some unexpected situations BAT would just show that the
`bfile_pp is not None` assertion failed. Now it also shows which file is
the one causing this issue, aiding in debugging the situation.
This commit is contained in:
Sybren A. Stüvel 2022-07-14 10:06:20 +02:00
parent 2aaf0896ba
commit 0e5d926e7a

View File

@ -475,7 +475,8 @@ class Packer:
# It is *not* used for any disk I/O, since the file may not even # It is *not* used for any disk I/O, since the file may not even
# exist on the local filesystem. # exist on the local filesystem.
bfile_pp = action.new_path bfile_pp = action.new_path
assert bfile_pp is not None assert bfile_pp is not None, \
f"Action {action.path_action.name} on {bfile_path} has no final path set, unable to process"
# Use tempfile to create a unique name in our temporary directoy. # Use tempfile to create a unique name in our temporary directoy.
# The file should be deleted when self.close() is called, and not # The file should be deleted when self.close() is called, and not