1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Make it harder to miss errors and warnings while developing Phabricator

Summary:
If a page generates warnings or errors, you only get a little red dot in
DarkConsole which is hard to see. DarkConsole is also fairly big and there are
plenty of reasons not to leave it open all the time.

Instead, unconditionally show a big message to developers if there are errors or
warnings.

We could make this more sophisticated eventually, but the value is just that you
see it.

Test Plan: Browsed pages with and without warnings, got the right banner state.

Reviewers: nh, btrahan, jungejason

Reviewed By: btrahan

CC: aran, btrahan

Maniphest Tasks: T734

Differential Revision: https://secure.phabricator.com/D1307
This commit is contained in:
epriestley 2012-01-04 07:35:52 -08:00
parent 28b606394b
commit d43dec1d12
5 changed files with 32 additions and 6 deletions

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -427,6 +427,10 @@ return array(
// You can enable traces for development to make it easier to debug problems.
'phabricator.show-stack-traces' => false,
// Shows an error callout if a page generated PHP errors, warnings or notices.
// This makes it harder to miss problems while developing Phabricator.
'phabricator.show-error-callout' => false,
// When users write comments which have URIs, they'll be automaticaly linked
// if the protocol appears in this set. This whitelist is primarily to prevent
// security issues like javascript:// URIs.

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,8 +18,9 @@
return array(
'darkconsole.enabled' => true,
'celerity.force-disk-reads' => true,
'phabricator.show-stack-traces' => true,
'darkconsole.enabled' => true,
'celerity.force-disk-reads' => true,
'phabricator.show-stack-traces' => true,
'phabricator.show-error-callout' => true,
) + phabricator_read_config_file('default');

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -364,8 +364,19 @@ class PhabricatorStandardPageView extends AphrontPageView {
'</div>';
}
$developer_warning = null;
if (PhabricatorEnv::getEnvConfig('phabricator.show-error-callout') &&
DarkConsoleErrorLogPluginAPI::getErrors()) {
$developer_warning =
'<div class="aphront-developer-error-callout">'.
'This page raised PHP errors. Find them in DarkConsole '.
'or the error log.'.
'</div>';
}
return
($console ? '<darkconsole />' : null).
$developer_warning.
'<div class="phabricator-standard-page '.$admin_class.'">'.
$header_chrome.
$this->bodyContent.

View file

@ -6,6 +6,7 @@
phutil_require_module('phabricator', 'aphront/console/plugin/errorlog/api');
phutil_require_module('phabricator', 'aphront/request');
phutil_require_module('phabricator', 'applications/people/storage/preferences');
phutil_require_module('phabricator', 'infrastructure/celerity/api');

View file

@ -179,3 +179,12 @@ td.phabricator-login-details {
font-family: "Menlo", "Consolas", "Monaco", monospace;
font-size: 10px;
}
.aphront-developer-error-callout {
padding: 2em;
background: #aa0000;
color: white;
text-align: center;
font-size: 11px;
font-family: "Verdana";
}