+ /**
+ * @class mw.MalformedTitleException
+ *
+ * Custom exception class that provides parameters for additional error
+ * information regarding the reason behind the invalidity of the requested
+ * title. The information can be used in i18n messages that can be displayed
+ * to the user.
+ *
+ * Based on MalformedTitleException.php#__construct
+ *
+ * @constructor
+ * @param {string} message Reason e.g. invalid-title-too-long for a long title
+ * @param {string} titleText The invalid title text involved
+ * @param {Array} errorMessageParameters Additional error information
+ */
+ function MalformedTitleException( message, titleText, errorMessageParameters ) {
+ this.message = message;
+ this.titleText = titleText;
+ if ( errorMessageParameters ) {
+ this.errorMessageParameters = errorMessageParameters;
+ } else {
+ this.errorMessageParameters = [ ];
+ }
+
+ if ( titleText ) {
+ this.errorMessageParameters.push( titleText );
+ }
+ }
+
+ MalformedTitleException.prototype = createObject(Error.prototype);
+ MalformedTitleException.prototype.name = 'MalformedTitleException';
+ MalformedTitleException.prototype.constructor = MalformedTitleException;
+ mw.MalformedTitleException = MalformedTitleException;
+