jenkins-bot has submitted this change and it was merged.
Change subject: Use mw.format() to format error messages
......................................................................
Use mw.format() to format error messages
Depends on I87f62ac47 in core.
Change-Id: I5d59cfe24fc0281acc73514605bb8631ad91bd39
---
M modules/ext.eventLogging.core.js
1 file changed, 11 insertions(+), 5 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ext.eventLogging.core.js b/modules/ext.eventLogging.core.js
index 2674d2f..eed5c14 100644
--- a/modules/ext.eventLogging.core.js
+++ b/modules/ext.eventLogging.core.js
@@ -120,7 +120,7 @@
for ( key in obj ) {
if ( !schema.properties.hasOwnProperty( key ) )
{
- errors.push( 'Undeclared property "' +
key + '"' );
+ errors.push( mw.format( 'Undeclared
property "$1"', key ) );
}
}
@@ -129,19 +129,25 @@
if ( !obj.hasOwnProperty( key ) ) {
if ( prop.required ) {
- errors.push( 'Missing property
"' + key + '"' );
+ errors.push( mw.format(
'Missing property "$1"', key ) );
}
continue;
}
val = obj[ key ];
if ( !( self.isInstanceOf( val, prop.type ) ) )
{
- errors.push( 'Value ' + JSON.stringify(
val ) + ' is the wrong type for property "' + key + '" (' + prop.type + '
expected)' );
+ errors.push( mw.format(
+ 'Value $1 is the wrong type for
property "$2" ($3 expected)',
+ JSON.stringify( val ), key,
prop.type
+ ) );
continue;
}
if ( prop[ 'enum' ] && $.inArray( val, prop[
'enum' ] ) === -1 ) {
- errors.push( 'Value ' + JSON.stringify(
val ) + ' for property "' + key + '" is not one of ' + JSON.stringify(
prop['enum'] ) );
+ errors.push( mw.format(
+ 'Value $1 for property "$2" is
not one of $3',
+ JSON.stringify( val ), key,
JSON.stringify( prop['enum'] )
+ ) );
}
}
@@ -182,7 +188,7 @@
valid = !errors.length;
while ( errors.length ) {
- mw.track( 'eventlogging.error', '[' +
schema.title + '] ' + errors.pop() );
+ mw.track( 'eventlogging.error', mw.format(
'[$1] $2', schemaName, errors.pop() ) );
}
return {
--
To view, visit https://gerrit.wikimedia.org/r/183153
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5d59cfe24fc0281acc73514605bb8631ad91bd39
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Nuria <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits