mirror of
https://github.com/hohn/sarif-cli.git
synced 2025-12-16 17:23:03 +01:00
Improve error reporting in sarif destructuring routines
This commit is contained in:
committed by
=Michael Hohn
parent
f5e258de52
commit
0fc6eb3cce
@@ -163,12 +163,18 @@ def _destructure_dict(typegraph: Typegraph, node, tree):
|
||||
# log.warning("XX: Tree has unrecognized fields")
|
||||
logging.warning('Input tree has unrecognized fields, collecting only '
|
||||
'known entries: {}'.format(tree))
|
||||
logging.warning('tree fields: {} type fields: {}'
|
||||
.format(tree_fields, type_fields))
|
||||
logging.warning('tree fields: {}'.format(sorted(tree_fields)))
|
||||
logging.warning('type fields: {}'.format(sorted(type_fields)))
|
||||
_destructure_dict_1(typegraph, node, tree)
|
||||
|
||||
elif set(tree_fields).issubset(set(type_fields)):
|
||||
raise MissingFieldException("XX: (Sub)tree is missing fields required by typedef")
|
||||
raise MissingFieldException(
|
||||
f"(Sub)tree is missing fields required by typedef.\n"
|
||||
f"Expected {type_fields}, found {tree_fields}.\n"
|
||||
f"Missing {set(type_fields) - set(tree_fields)}\n"
|
||||
f"Note: these fields are post-signature fill and may be more extensive than the orginal. \n"
|
||||
f"Check input file for the original signature."
|
||||
)
|
||||
|
||||
else:
|
||||
raise Exception("typegraph: unhandled case reached: cannot match type "
|
||||
|
||||
Reference in New Issue
Block a user