-
Notifications
You must be signed in to change notification settings - Fork 29.9k
/
Error.d.ts
86 lines (79 loc) · 2.99 KB
/
Error.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
declare namespace OO.ui {
/**
* Errors contain a required message (either a string or jQuery selection) that is used to
* describe what went wrong in a {@link OO.ui.Process process}. The error's
* {@link Error.ConfigOptions.recoverable recoverable} and {@link Error.ConfigOptions.warning 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](https://www.mediawiki.org/wiki/OOUI/Windows/Process_Dialogs#Processes_and_errors).
*
* ResourceLoader module: `oojs-ui-windows`
*
* @see https://doc.wikimedia.org/oojs-ui/master/js/#!/api/OO.ui.Error
*/
interface Error {
/**
* Check if the error is recoverable.
*
* If the error is recoverable, users are able to try the process again.
*
* @return Error is recoverable
*/
isRecoverable(): 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.
*
* @return Error is warning
*/
isWarning(): boolean;
/**
* Get error message as DOM nodes.
*
* @return Error message in DOM nodes
*/
getMessage(): JQuery;
/**
* Get the error message text.
*
* @return Error message
*/
getMessageText(): string;
}
namespace Error {
interface ConfigOptions {
/**
* Error is recoverable.
* By default, errors are recoverable, and users can try the process again.
*/
recoverable?: boolean;
/**
* 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.
*/
warning?: boolean;
}
interface Constructor {
/**
* @param message Description of error
* @param config Configuration options
*/
new(message: string | JQuery, config?: ConfigOptions): Error;
prototype: Error;
static: {};
}
}
const Error: Error.Constructor;
}