@@ -389,9 +389,23 @@ def encode(self, variables, attributes):
389389 attributes : dict-like
390390
391391 """
392- variables = {k : self .encode_variable (v , name = k ) for k , v in variables .items ()}
393- attributes = {k : self .encode_attribute (v ) for k , v in attributes .items ()}
394- return variables , attributes
392+ encoded_variables = {}
393+ for k , v in variables .items ():
394+ try :
395+ encoded_variables [k ] = self .encode_variable (v )
396+ except Exception as e :
397+ e .add_note (f"Raised while encoding variable { k !r} with value { v !r} " )
398+ raise
399+
400+ encoded_attributes = {}
401+ for k , v in attributes .items ():
402+ try :
403+ encoded_attributes [k ] = self .encode_attribute (v )
404+ except Exception as e :
405+ e .add_note (f"Raised while encoding attribute { k !r} with value { v !r} " )
406+ raise
407+
408+ return encoded_variables , encoded_attributes
395409
396410 def encode_variable (self , v , name = None ):
397411 """encode one variable"""
@@ -641,9 +655,7 @@ def encode(self, variables, attributes):
641655 variables = {
642656 k : ensure_dtype_not_object (v , name = k ) for k , v in variables .items ()
643657 }
644- variables = {k : self .encode_variable (v , name = k ) for k , v in variables .items ()}
645- attributes = {k : self .encode_attribute (v ) for k , v in attributes .items ()}
646- return variables , attributes
658+ return super ().encode (variables , attributes )
647659
648660
649661class BackendEntrypoint :
0 commit comments