Skip to content

Commit b38c89b

Browse files
committed
Update error handling.
1 parent 7d690f6 commit b38c89b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

newrelic/api/llm_custom_attributes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
class WithLlmCustomAttributes(object):
2525
def __init__(self, custom_attr_dict):
2626
transaction = current_transaction()
27-
if not isinstance(custom_attr_dict, dict) or custom_attr_dict is None:
28-
raise TypeError("custom_attr_dict must be a dictionary. Received type: %s" % type(custom_attr_dict))
27+
if not custom_attr_dict or not isinstance(custom_attr_dict, dict):
28+
raise TypeError("custom_attr_dict must be a non-empty dictionary. Received type: %s" % type(custom_attr_dict))
2929

3030
# Add "llm." prefix to all keys in attribute dictionary
3131
context_attrs = {k if k.startswith("llm.") else f"llm.{k}": v for k, v in custom_attr_dict.items()}

0 commit comments

Comments
 (0)