Repository: activeloopai/Hub
File: deeplake/util/exceptions.py (Python)

Code before:
    return isinstance(sample, LinkedSample) or (
        isinstance(sample, Sample) and sample.path is not None
    )


class TransformError(Exception):
    def __init__(self, index=None, sample=None, samples_processed=0):
        self.index = index
        self.sample = sample
        # multiprocessing re raises error with str
        if isinstance(index, str):
            super().__init__(index)
        else:
            print_item = print_path = False
            if sample:
                print_item = is_primitive(sample)
                print_path = has_path(sample)

            msg = f"Transform failed"
            if index is not None:
                msg += f" at index {index} of the input data"

            if print_item:
                msg += f" on the item: {sample}"
            elif print_path:
                msg += f"on the sample at path: '{sample.path}'"
            msg += "."

            if samples_processed > 0:
                msg += f" Last checkpoint: {samples_processed} samples processed. You can slice the input to resume from this point."

            msg += " See traceback for more details."
            super().__init__(msg)


class SampleAppendError(Exception):
    def __init__(self, tensor, sample=None):
        print_item = print_path = False
        if sample:
            print_item = is_primitive(sample)
            print_path = has_path(sample)
        if print_item or print_path:
            msg = "Failed to append the sample "

            if print_item:
                msg += str(sample) + " "
            elif print_path:
                msg += f"at path '{sample.path}' "
        else:
            msg = f"Failed to append a sample "


Review comment (suggestion):
```suggestion
                msg += f" on the sample at path: '{sample.path}'"
```

Code after:
    return isinstance(sample, LinkedSample) or (
        isinstance(sample, Sample) and sample.path is not None
    )


class TransformError(Exception):
    def __init__(self, index=None, sample=None, samples_processed=0):
        self.index = index
        self.sample = sample
        # multiprocessing re raises error with str
        if isinstance(index, str):
            super().__init__(index)
        else:
            print_item = print_path = False
            if sample:
                print_item = is_primitive(sample)
                print_path = has_path(sample)

            msg = f"Transform failed"
            if index is not None:
                msg += f" at index {index} of the input data"

            if print_item:
                msg += f" on the item: {sample}"
            elif print_path:
                msg += f" on the sample at path: '{sample.path}'"
            msg += "."

            if samples_processed > 0:
                msg += f" Last checkpoint: {samples_processed} samples processed. You can slice the input to resume from this point."

            msg += " See traceback for more details."
            super().__init__(msg)


class SampleAppendError(Exception):
    def __init__(self, tensor, sample=None):
        print_item = print_path = False
        if sample:
            print_item = is_primitive(sample)
            print_path = has_path(sample)
        if print_item or print_path:
            msg = "Failed to append the sample "

            if print_item:
                msg += str(sample) + " "
            elif print_path:
                msg += f"at path '{sample.path}' "
        else:
            msg = f"Failed to append a sample "