mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-24 00:05:00 +00:00
Add name to nosuchfunction and nosuchmodule errors
When displaying a nosuchfunction or nosuchmodule error, include the name of the nonexistent function or module. Change-Id: I17fc2c68dc8267302a82eee3cb2c5df9b5a3c46c
This commit is contained in:
parent
ee4f9b3346
commit
d74c81c233
|
@ -94,11 +94,11 @@ class ScribuntoHooks {
|
|||
$engine = Scribunto::getParserEngine( $parser );
|
||||
$title = Title::makeTitleSafe( NS_MODULE, $moduleName );
|
||||
if ( !$title || Scribunto::isDocPage( $title ) ) {
|
||||
throw new ScribuntoException( 'scribunto-common-nosuchmodule' );
|
||||
throw new ScribuntoException( 'scribunto-common-nosuchmodule', array( 'args' => array( $moduleName ) ) );
|
||||
}
|
||||
$module = $engine->fetchModuleFromParser( $title );
|
||||
if ( !$module ) {
|
||||
throw new ScribuntoException( 'scribunto-common-nosuchmodule' );
|
||||
throw new ScribuntoException( 'scribunto-common-nosuchmodule', array( 'args' => array( $moduleName ) ) );
|
||||
}
|
||||
$functionName = trim( $frame->expand( $args[1] ) );
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ class Scribunto_LuaModule extends ScribuntoModuleBase {
|
|||
public function invoke( $name, $frame ) {
|
||||
$exports = $this->execute();
|
||||
if ( !isset( $exports[$name] ) ) {
|
||||
throw $this->engine->newException( 'scribunto-common-nosuchfunction' );
|
||||
throw $this->engine->newException( 'scribunto-common-nosuchfunction', array( 'args' => array( $name ) ) );
|
||||
}
|
||||
|
||||
$result = $this->engine->executeFunctionChunk( $exports[$name], $frame );
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
"scribunto-console-cleared-session-lost": "The console state was cleared because the session data was lost.",
|
||||
"scribunto-common-error-category": "Pages with script errors",
|
||||
"scribunto-common-error-category-desc": "There was an error when processing the modules included on the page.",
|
||||
"scribunto-common-nosuchmodule": "Script error: No such module.",
|
||||
"scribunto-common-nosuchmodule": "Script error: No such module \"$2\".",
|
||||
"scribunto-common-nofunction": "Script error: You must specify a function to call.",
|
||||
"scribunto-common-nosuchfunction": "Script error: The function you specified did not exist.",
|
||||
"scribunto-common-nosuchfunction": "Script error: The function \"$2\" does not exist.",
|
||||
"scribunto-common-timeout": "The time allocated for running scripts has expired.",
|
||||
"scribunto-common-oom": "The amount of memory allowed for running scripts has been exceeded.",
|
||||
"scribunto-common-backtrace": "Backtrace:",
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
"scribunto-console-cleared-session-lost": "Message displayed in the console when the session has expired.",
|
||||
"scribunto-common-error-category": "Tracking category for pages with errors from #invoke",
|
||||
"scribunto-common-error-category-desc": "Description on [[Special:TrackingCategories]] for the {{msg-mw|scribunto-common-error-category}} tracking category.",
|
||||
"scribunto-common-nosuchmodule": "Error message displayed when referencing a non-existing module.",
|
||||
"scribunto-common-nosuchmodule": "Error message displayed when referencing a non-existing module. Parameters:\n* $1 - (Unused)\n* $2 - the title of the module",
|
||||
"scribunto-common-nofunction": "Error message displayed when not specifying a function to call.",
|
||||
"scribunto-common-nosuchfunction": "Error message displayed when referencing a non-existing function.",
|
||||
"scribunto-common-nosuchfunction": "Error message displayed when referencing a non-existing function. Parameters:\n* $1 - (Unused)\n* $2 - the name of the function",
|
||||
"scribunto-common-timeout": "Error message displayed when script execution has passed a threshold.",
|
||||
"scribunto-common-oom": "Error message displayed when the script requires more memory than the threshold.",
|
||||
"scribunto-common-backtrace": "A backtrace is a list of the function calls that are currently active in a thread. This message is followed by a backtrace.",
|
||||
|
|
|
@ -185,7 +185,7 @@ Scribunto: no such module
|
|||
!! input
|
||||
{{#invoke:foo|bar}}
|
||||
!! result
|
||||
<p><strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Script error<!--Script error: No such module.--></span></strong>
|
||||
<p><strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Script error<!--Script error: No such module "foo".--></span></strong>
|
||||
</p>
|
||||
!! end
|
||||
|
||||
|
@ -194,7 +194,7 @@ Scribunto: no such function
|
|||
!! input
|
||||
{{#invoke:test|blah}}
|
||||
!! result
|
||||
<p><strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Script error<!--Script error: The function you specified did not exist.--></span></strong>
|
||||
<p><strong class="error"><span class="scribunto-error" id="mw-scribunto-error-0">Script error<!--Script error: The function "blah" does not exist.--></span></strong>
|
||||
</p>
|
||||
!! end
|
||||
|
||||
|
|
Loading…
Reference in a new issue