Improve logging for syntax highlighting parsing

Summary:
add logging when syntax highlighting parsing throws exception.

Test Plan:
test when exception is thrown with non-php code. I couldn't
create a file to trigger an exception in running pygmentiza, so I
manually threw an exception to test it.

Reviewed By: tuomaspelkonen
Reviewers: tuomaspelkonen, epriestley
CC: aran, tuomaspelkonen, jungejason
Differential Revision: 350
This commit is contained in:
jungejason
2011-05-26 14:17:12 -07:00
parent 6c3b1feec8
commit 686ffafa21
2 changed files with 17 additions and 11 deletions

View File

@@ -464,6 +464,7 @@ class DifferentialChangesetParser {
'new' => $new_future, 'new' => $new_future,
); );
foreach (Futures($futures) as $key => $future) { foreach (Futures($futures) as $key => $future) {
try {
switch ($key) { switch ($key) {
case 'old': case 'old':
$this->oldRender = $this->processHighlightedSource( $this->oldRender = $this->processHighlightedSource(
@@ -476,6 +477,10 @@ class DifferentialChangesetParser {
$future->resolve()); $future->resolve());
break; break;
} }
} catch (Exception $ex) {
phlog($ex);
throw $ex;
}
} }
$this->applyIntraline( $this->applyIntraline(

View File

@@ -18,6 +18,7 @@ phutil_require_module('phabricator', 'infrastructure/env');
phutil_require_module('phabricator', 'infrastructure/javelin/markup'); phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'storage/queryfx'); phutil_require_module('phabricator', 'storage/queryfx');
phutil_require_module('phutil', 'error');
phutil_require_module('phutil', 'filesystem'); phutil_require_module('phutil', 'filesystem');
phutil_require_module('phutil', 'filesystem/tempfile'); phutil_require_module('phutil', 'filesystem/tempfile');
phutil_require_module('phutil', 'future'); phutil_require_module('phutil', 'future');