Allow opening editor from DarkConsole error log

Test Plan:
Click on "passing a null index to idx()" in DarkConsole.
Click on entry in stack trace.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2275
This commit is contained in:
vrana
2012-04-18 12:50:06 -07:00
parent 3c22bebc9b
commit 1772410a2b
4 changed files with 14 additions and 11 deletions

View File

@@ -388,7 +388,7 @@ celerity_register_resource_map(array(
),
'aphront-dark-console-css' =>
array(
'uri' => '/res/1a9f84bb/rsrc/css/aphront/dark-console.css',
'uri' => '/res/4965d970/rsrc/css/aphront/dark-console.css',
'type' => 'css',
'requires' =>
array(
@@ -1034,7 +1034,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-error-log' =>
array(
'uri' => '/res/a5cb42a5/rsrc/js/application/core/behavior-error-log.js',
'uri' => '/res/f46289e9/rsrc/js/application/core/behavior-error-log.js',
'type' => 'js',
'requires' =>
array(

View File

@@ -75,17 +75,21 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
$line .= $entry['class'].'::';
}
$line .= idx($entry, 'function', '');
$onclick = '';
$href = null;
if (isset($entry['file'])) {
$line .= ' called at ['.$entry['file'].':'.$entry['line'].']';
$onclick = jsprintf(
'open_file(%s, %d)', $entry['file'], $entry['line']);
try {
$user = $this->getRequest()->getUser();
$href = $user->loadEditorLink($entry['file'], $entry['line'], '');
} catch (Exception $ex) {
// The database can be inaccessible.
}
}
$details .= phutil_render_tag(
'a',
array(
'onclick' => $onclick,
'href' => $href,
),
phutil_escape_html($line));
$details .= "\n";