You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
bug: better error message after calling to_doc_list on DocVec #1563
When calling to_doc_list on a DocVec it destroys (delete) the storage of DocVec and therefore the DocVec is not usable.
Nevertheless we can still have a reference to the DocVec object, if we try to call any method on it it will fail with a weird error message. While it is expected that it fail the error message should clearly explain what is the problem: the DocVec should not be used anymore because its content has been moved to a DocList.
Traceback (most recent call last):
File "/home/sami/.config/JetBrains/PyCharmCE2023.1/scratches/scratch_2.py", line 11, in<module>
print(docs)
File "/home/sami/Documents/workspace/Jina/docarray2/docarray/docarray/array/any_collections.py", line 38, in __repr__
return f'<{self.__class__.__name__} (length={len(self)})>'
File "/home/sami/Documents/workspace/Jina/docarray2/docarray/docarray/array/doc_vec/doc_vec.py", line 507, in __len__
return len(self._storage)
File "/home/sami/Documents/workspace/Jina/docarray2/docarray/docarray/array/any_array.py", line 51, in __getattr__
returnsuper().__getattribute__(item)
AttributeError: 'DocVec[ImageDoc]' object has no attribute '_storage'
Expected results
We should rather yield a more explicit error message
RuntimeError: 'DocVec[ImageDoc] has been destroy and cannot be used anymore. Probably because you call `to_doc_list()` on it'
changed the title [-]feat: better error message after calling `to_doc_list` on DocVec[/-][+]bug: better error message after calling `to_doc_list` on DocVec[/+]on May 23, 2023
Activity
[-]feat: better error message after calling `to_doc_list` on DocVec[/-][+]bug: better error message after calling `to_doc_list` on DocVec[/+]