Page MenuHomePhabricator

Improve XHPAST handling of syntax errors
ClosedPublic

Authored by joshuaspence on Sep 1 2015, 10:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 5:04 AM
Unknown Object (File)
Sun, Apr 7, 6:07 AM
Unknown Object (File)
Wed, Apr 3, 10:51 AM
Unknown Object (File)
Wed, Apr 3, 10:51 AM
Unknown Object (File)
Wed, Apr 3, 10:51 AM
Unknown Object (File)
Wed, Apr 3, 10:51 AM
Unknown Object (File)
Wed, Apr 3, 10:51 AM
Unknown Object (File)
Tue, Apr 2, 2:10 AM
Subscribers

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Commits
Restricted Diffusion Commit
rPa2f909f0bd0a: Improve XHPAST handling of syntax errors
Summary

Currently, a bunch of developers are using XHPAST for writing custom linter rules. As such, we end up with a fair few XHPASTSyntaxErrorException in our PHP error logs. I think that throwing an exception is not quite correct in this case because it is somewhat expected that invalid PHP may be entered. Instead, catch the exception and show the user a helpful message.

Test Plan

This doesn't quite work yet... the stream and tree views render as blank but the exceptions still propogate to the error logs. Mostly, I'm not sure how the exception should be rendered for display.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Improve XHPAST handling of syntax errors.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

Maybe just put the stuff on the main page?

So you normally get this:

Phabricator > XHPAST > Tree 92
+--------+-----+--------+
| source | ast | tokens |
+--------+-----+--------+

..but just do this?

Phabricator > XHPAST > Tree 93

>> ERROR: You are bad at syntax! <<

+--------+---------+---------+
| source | (empty) | (empty) |
+--------+---------+---------+
joshuaspence edited edge metadata.
  • Minor tidying up
  • Show exception text
epriestley edited edge metadata.
This revision is now accepted and ready to land.Nov 8 2015, 2:17 PM
joshuaspence edited edge metadata.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence edited the test plan for this revision. (Show Details)

Minor changes

This revision was automatically updated to reflect the committed changes.