aboutsummaryrefslogtreecommitdiffstats
path: root/includes/MediaWiki.php
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2021-03-22 17:07:18 -0700
committerAaron Schulz <aschulz@wikimedia.org>2021-03-22 17:07:18 -0700
commit06ef99a4b4fbab289998acbe119213e41a04bbdf (patch)
tree0cb073fc37b7cfd35c23af188b70f2d6cd4bebd9 /includes/MediaWiki.php
parent84f96999236195080d0e6473e7dcd5e649cc0b29 (diff)
downloadmediawikicore-06ef99a4b4fbab289998acbe119213e41a04bbdf.tar.gz
mediawikicore-06ef99a4b4fbab289998acbe119213e41a04bbdf.zip
Limit the scope of when ErrorPageError is expected to be thrown
Move the try/catch logic to the performRequest() call in main() Change-Id: I30fee12ad2f04368386fae0221d2b513e9013ce0
Diffstat (limited to 'includes/MediaWiki.php')
-rw-r--r--includes/MediaWiki.php28
1 files changed, 12 insertions, 16 deletions
diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 8f82a85bdb5a..ebf14052fc7a 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -543,20 +543,7 @@ class MediaWiki {
public function run() {
try {
$this->setDBProfilingAgent();
- try {
- $this->main();
- } catch ( ErrorPageError $e ) {
- $out = $this->context->getOutput();
- // TODO: Should ErrorPageError::report accept a OutputPage parameter?
- $e->report( ErrorPageError::STAGE_OUTPUT );
- $out->considerCacheSettingsFinal();
-
- // T64091: while exceptions are convenient to bubble up GUI errors,
- // they are not internal application faults. As with normal requests, this
- // should commit, print the output, do deferred updates, jobs, and profiling.
- $this->doPreOutputCommit();
- $out->output(); // display the GUI error
- }
+ $this->main();
} catch ( Exception $e ) {
$context = $this->context;
$action = $context->getRequest()->getVal( 'action', 'view' );
@@ -921,8 +908,17 @@ class MediaWiki {
}
}
- // Actually do the work of the request and build up any output
- $this->performRequest();
+ try {
+ // Actually do the work of the request and build up any output
+ $this->performRequest();
+ } catch ( ErrorPageError $e ) {
+ // TODO: Should ErrorPageError::report accept a OutputPage parameter?
+ $e->report( ErrorPageError::STAGE_OUTPUT );
+ $output->considerCacheSettingsFinal();
+ // T64091: while exceptions are convenient to bubble up GUI errors,
+ // they are not internal application faults. As with normal requests, this
+ // should commit, print the output, do deferred updates, jobs, and profiling.
+ }
// GUI-ify and stash the page output in MediaWiki::doPreOutputCommit()
$buffer = null;