Skip to content

misleading error msg for dst OSError, bad exception handling #23

@ThomasWaldmann

Description

@ThomasWaldmann

It will have the src filename in the error msg, even if the dst file / hash file raised the exception:

            try:
                with self.path_helper.abs_src_filepath.open("rb") as in_file:
                    with self.path_helper.abs_dst_hash_filepath.open("w") as hash_file:
                        with self.path_helper.abs_dst_filepath.open("wb") as out_file:
                            hash = self._deduplication_backup(self.dir_path, in_file, out_file, process_bar)
                        hash_hexdigest = hash.hexdigest()
                        hash_file.write(hash_hexdigest)
            except OSError as err:
                # FIXME: Better error message
                raise BackupFileError(
                    "Skip file %s error: %s" % (self.path_helper.abs_src_filepath, err))

Also, you maybe will want to log-and-continue on src file exceptions.

But you must not log-and-continue on dst file exceptions, they must be fatal.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions