Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4061483
ScribuntoException.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
ScribuntoException.php
View Options
<?php
namespace
MediaWiki\Extension\Scribunto
;
use
Exception
;
use
MediaWiki\Status\Status
;
use
MediaWiki\Title\Title
;
/**
* An exception class which represents an error in the script. This does not
* normally abort the request, instead it is caught and shown to the user.
*/
class
ScribuntoException
extends
Exception
{
/**
* @var string
*/
public
$messageName
;
/**
* @var array
*/
public
$messageArgs
;
/**
* @var array
*/
public
$params
;
/**
* @param string $messageName
* @param array $params
*/
public
function
__construct
(
$messageName
,
$params
=
[]
)
{
$this
->
messageArgs
=
$params
[
'args'
]
??
[];
if
(
isset
(
$params
[
'module'
]
)
&&
isset
(
$params
[
'line'
]
)
)
{
$codeLocation
=
false
;
if
(
isset
(
$params
[
'title'
]
)
)
{
$moduleTitle
=
Title
::
newFromText
(
$params
[
'module'
]
);
if
(
$moduleTitle
&&
$moduleTitle
->
equals
(
$params
[
'title'
]
)
)
{
$codeLocation
=
wfMessage
(
'scribunto-line'
,
$params
[
'line'
]
)->
inContentLanguage
()->
text
();
}
}
if
(
$codeLocation
===
false
)
{
$codeLocation
=
wfMessage
(
'scribunto-module-line'
,
$params
[
'module'
],
$params
[
'line'
]
)->
inContentLanguage
()->
text
();
}
}
else
{
$codeLocation
=
'[UNKNOWN]'
;
}
array_unshift
(
$this
->
messageArgs
,
$codeLocation
);
$msg
=
wfMessage
(
$messageName
)
->
params
(
$this
->
messageArgs
)
->
inContentLanguage
();
if
(
isset
(
$params
[
'title'
]
)
)
{
$msg
=
$msg
->
page
(
$params
[
'title'
]
);
}
parent
::
__construct
(
$msg
->
text
()
);
$this
->
messageName
=
$messageName
;
$this
->
params
=
$params
;
}
/**
* @return string
*/
public
function
getMessageName
()
{
return
$this
->
messageName
;
}
public
function
toStatus
()
{
$status
=
Status
::
newFatal
(
$this
->
messageName
,
...
$this
->
messageArgs
);
$status
->
value
=
$this
;
return
$status
;
}
/**
* Get the backtrace as HTML, or false if there is none available.
* @param array $options
* @return bool|string
*/
public
function
getScriptTraceHtml
(
$options
=
[]
)
{
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 16 2026, 09:18 (12 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b2/a5/b4a8aabd4eca89dd0a4bb17f5455
Default Alt Text
ScribuntoException.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment