Expand all

OO.ui.Error

Constructor

new OO.ui.Error(message, [config]) #

Errors contain a required message (either a string or jQuery selection) that is used to describe what went wrong in a process. The error's #recoverable and #warning configurations are used to customize the appearance and functionality of the error interface.

The basic error interface contains a formatted error message as well as two buttons: 'Dismiss' and 'Try again' (i.e., the error is 'recoverable' by default). If the error is not recoverable, the 'Try again' button will not be rendered and the widget that initiated the failed process will be disabled.

If the error is a warning, the error interface will include a 'Dismiss' and a 'Continue' button, which will try the process again.

For an example of error interfaces, please see the OOUI documentation on MediaWiki.

Parameters:

Name Type Attributes Description
message string | jQuery

Description of error

config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
recoverable boolean optional
true

Error is recoverable. By default, errors are recoverable, and users can try the process again.

warning boolean optional
false

Error is a warning. If the error is a warning, the error interface will include a 'Dismiss' and a 'Continue' button. It is the responsibility of the developer to ensure that the warning is not triggered a second time if the user chooses to continue.

Source:

Errors contain a required message (either a string or jQuery selection) that is used to describe what went wrong in a process.

Methods

getMessage() → {jQuery} #

Get error message as DOM nodes.

Source:

Returns:

Error message in DOM nodes

Type
jQuery
Get error message as DOM nodes.

getMessageText() → {string} #

Get the error message text.

Source:

Returns:

Error message

Type
string
Get the error message text.

isRecoverable() → {boolean} #

Check if the error is recoverable.

If the error is recoverable, users are able to try the process again.

Source:

Returns:

Error is recoverable

Type
boolean
Check if the error is recoverable.

isWarning() → {boolean} #

Check if the error is a warning.

If the error is a warning, the error interface will include a 'Dismiss' and a 'Continue' button.

Source:

Returns:

Error is warning

Type
boolean
Check if the error is a warning.