-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
preprocessor: fix error handling for validation of #location
There can be multiple sidebyside nodes in a guide. When validating nodes in a guide, we validate them sequentially, but want to report all errors in the file rather than stopping at the first error in the first node (such behaviour would not be helpful to the author of a guide). As such, the signature of validatingNode.validate() was not helpful: validate() error This suggested that the callee should return an error, probably the first error, rather than recording errors against the implementer of validate(). errorContext exists for just this purpose: to allow the implementer to record multiple errors, and then have the caller check $implementer.isInError(). Make all nodes implement errorContext therefore, and update the validate signature to simply: validate() along with an appropriate comment, to make clear it is the implementer's job to record errors. This requires us to fix validate() implementations in a couple of places, recording errors instead of returning them, and making explicit where we return early in some situations (because later validation requires certain preconditions to hold). The one test change here is the addition of a log message, which confirms we do now report multiple errors in the same file (across multiple nodes). Signed-off-by: Paul Jolly <[email protected]> Preprocessor-No-Write-Cache: true Change-Id: Ifdbe91f6648a381cf263c3ececb7bc4a8c8f67c9 Dispatch-Trailer: {"type":"trybot","CL":1169948,"patchset":6,"ref":"refs/changes/48/1169948/6","targetBranch":"alpha"}
- Loading branch information
Showing
8 changed files
with
47 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters