MCPcopy
hub / github.com/marshmallow-code/marshmallow / store_error

Method store_error

src/marshmallow/error_store.py:17–26  ·  view source on GitHub ↗
(self, messages, field_name=SCHEMA, index=None)

Source from the content-addressed store, hash-verified

15 self.errors = {}
16
17 def store_error(self, messages, field_name=SCHEMA, index=None):
18 # field error -> store/merge error messages under field name key
19 # schema error -> if string or list, store/merge under _schema key
20 # -> if dict, store/merge with other top-level keys
21 messages = copy_containers(messages)
22 if field_name != SCHEMA or not isinstance(messages, dict):
23 messages = {field_name: messages}
24 if index is not None:
25 messages = {index: messages}
26 self.errors = merge_errors(self.errors, messages)
27
28
29def copy_containers(errors):

Callers 5

test_list_not_changedMethod · 0.95
test_dict_not_changedMethod · 0.95
_call_and_storeMethod · 0.80
_deserializeMethod · 0.80
_run_validatorMethod · 0.80

Calls 2

copy_containersFunction · 0.85
merge_errorsFunction · 0.85

Tested by 2

test_list_not_changedMethod · 0.76
test_dict_not_changedMethod · 0.76