When traversing a tree in order to compare it with another tree, it is hard to report the relevant errors only, and report them in a meaningful way. The invention seeks to provide a method for representing failures using exceptions thereby keeping the code simple but retaining exactly the information needed to know what the difference was, in a structured manner.
Generation and display of failure trees using exceptions when matching results
When matching up two trees of objects, if they do not match, it is not necessarily obvious which of the objects in the tree should have matched if the system was behaving correctly. If the trees are traversed depth first, backtracking if there is an difference until all options have been taken or the trees are completely matched, then it is possible to tell whether they are the same or not. However, since there is a certain amount of backtracking involved in a successful match, it cannot be guaranteed that all of the backtracks are errors, and even if there is an error some of the backtracks may have happened legitimately and be irrelevant to the problem. They can be logged to the screen and left to the user to decide. The user can finish the matching with an exception saying that there was a problem, however, exceptions are linear lists of "caused by...." so there is no scope for grouping backtracks that happened at the same level.
This means that generally a user gets an error saying that the top level documents didn't match, but no indication of which level the actual mismatch was, also which part of the tree had the mismatch but should have been the same and what was the difference (one of the key pieces of info) and what path it is from the root document to the nonmatching object (the other key piece of info).
The invention is as follows, a...