Skip to content

Commit acfaf0e

Browse files
fix: Raise error instead of returning 'bytes' for missing field
Address reviewer feedback from PR #1330: attr should never be None since field_name comes from heading.names. Raising an error surfaces bugs immediately rather than silently returning a misleading placeholder. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 9f6826e commit acfaf0e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/datajoint/preview.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ def _format_object_display(json_data):
2626

2727
def _get_blob_placeholder(heading, field_name, html_escape=False):
2828
"""Get display placeholder for a blob/json field based on its codec."""
29+
from .errors import DataJointError
30+
2931
attr = heading.attributes.get(field_name)
3032
if attr is None:
31-
return "bytes"
33+
raise DataJointError(f"Field '{field_name}' not found in heading")
3234
if attr.codec is not None:
3335
name = attr.codec.name
3436
if html_escape:

0 commit comments

Comments
 (0)