Page MenuHomePhabricator

Improve XHPAST handling of syntax errors
ClosedPublic

Authored by joshuaspence on Sep 1 2015, 10:22 AM.
Tags
None
Referenced Files
F14050256: D14028.diff
Thu, Nov 14, 5:32 PM
F14048303: D14028.diff
Thu, Nov 14, 7:25 AM
F14038810: D14028.diff
Mon, Nov 11, 2:12 AM
F14024814: D14028.diff
Thu, Nov 7, 12:30 PM
F14023812: D14028.id34906.diff
Thu, Nov 7, 3:49 AM
F14023811: D14028.id34905.diff
Thu, Nov 7, 3:49 AM
F14023810: D14028.id34891.diff
Thu, Nov 7, 3:49 AM
F14003722: D14028.id33916.diff
Sat, Oct 26, 9:53 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.