Make malformed configuration exceptions typed #544
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A malformed configuration exception occurs when either the taint.config
file is not found or it is not a valid json file. During the validation
of taint.config file with the json specs, we raised an exception if it
was illegal.
Now added code to pretty print the exception via Log.error and specify
the line number and column number along with the file name.
Since YoJSON doesn't expose or store line numbers, this is implemented
by creating a custom Bi_output buffer and specifying it to YoJSON so
that YoJSON uses it for parsing and the last line of the contents would
be the line in which the error occured and the position and length of
such the last line would give us the line number and column number of
the error.
Test Plan
taint.config
file by deleting a,
or in some other waypyre analyze
(with$PYRE_BINARY
pointing to the newly built binary)taint.config
to initial versionpyre analyze
again to make sure nothing is broken with this change :)Before this change:
After this change:
Fixes part of: MLH-Fellowship#82
Signed-off-by: Abishek V Ashok [email protected]