Prtksxna has uploaded a new change for review.
https://gerrit.wikimedia.org/r/231250
Change subject: FieldLayout: Throw an error if no widget is provided
......................................................................
FieldLayout: Throw an error if no widget is provided
Bug: T76648
Change-Id: I6838d3538a3eb302027d2227843b73df4a791f38
---
M src/layouts/FieldLayout.js
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/50/231250/1
diff --git a/src/layouts/FieldLayout.js b/src/layouts/FieldLayout.js
index 9fcc237..ad4cd02 100644
--- a/src/layouts/FieldLayout.js
+++ b/src/layouts/FieldLayout.js
@@ -34,8 +34,15 @@
* @cfg {string|OO.ui.HtmlSnippet} [help] Help text. When help text is
specified, a "help" icon will appear
* in the upper-right corner of the rendered field; clicking it will display
the text in a popup.
* For important messages, you are advised to use `notices`, as they are
always shown.
+ *
+ * @throws {Error} An error is thrown if no widget is specified
*/
OO.ui.FieldLayout = function OoUiFieldLayout( fieldWidget, config ) {
+ // Make sure we have required constructor arguments
+ if ( fieldWidget === undefined ) {
+ throw new Error( 'Widget not found' );
+ }
+
// Allow passing positional parameters inside the config object
if ( OO.isPlainObject( fieldWidget ) && config === undefined ) {
config = fieldWidget;
--
To view, visit https://gerrit.wikimedia.org/r/231250
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6838d3538a3eb302027d2227843b73df4a791f38
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Prtksxna <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits