-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserError.html
More file actions
115 lines (96 loc) · 4.76 KB
/
Copy pathuserError.html
File metadata and controls
115 lines (96 loc) · 4.76 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
layout: default
---
<div class="content">
<h1>UserError <span class="extends">extends <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error">Error</a></span></h1>
<p>This is an extension of the standard JavaScript <u>Error</u> object.</p>
<p>It should be used for errors that were caused by user actions or user data, that the user should be able to correct.</p>
<p>This is contrast to <a href="appError"><u>AppError</u></a> which indicates an application-level error that represents an internal
error within the application code.</p>
<p><u>UserError</u> is also used to contain validation errors when doing form validation.</p>
<p>See <a href="exceptions">Exceptions</a> for more information.</p>
<h2>constructor</h2>
<article id="constructor">
<b class="constructor"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">(opts: object | string)</span>
<p>If <u>opts</u> is a string, then it contains the <i>message</i> description of the problem. The <i>technical</i> will default to being <u>undefined</u>.
<p>If <u>opts</u> is an objec†, then:
<pre><code class="js">{
message: string; <i>// This message contains an end-user-facing error message that can be displayed in the UI.</i>
technical?: string; <i>// If present, this should contain additional technical information that would be relevant to a software developer.</i>
field?: <a href="field">Field</a>; <i>// This indicates an error is directly related to a given field.</i>
lineNumber?: number; <i>// This indicates any line number that has to do with the error message.</i>
rowNumber?: number; <i>// This indicates any row number that has to do with the error message.</i>
columnNumber?: number; <i>// This indicates any column number that has to do with the error message.</i>
}
</code></pre>
</article>
<h2>instance</h2>
<article id="columnNumber">
<b class="property"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">columnNumber?: number</span>
<p>This indicates any column number that has to do with the error message. For <u>UserError</u>s this could refer to a column in
a UI table or a multi-line form field, for example so that client-code can better identify the source of the error to the user.</p>
</article>
<article id="field">
<b class="property"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">field?: <a href="field">Field</a></span>
<p>This indicates an error is directly related to a given field.</p>
</article>
<article id="lineNumber">
<b class="property"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">lineNumber?: number</span>
<p>This indicates any line number that has to do with the error message.</p>
</article>
<article id="message">
<b class="property"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">message: string</span>
<p>This message contains an end-user-facing error message that can be displayed in the UI.</p>
</article>
<article id="rowNumber">
<b class="property"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">rowNumber?: number</span>
<p>This indicates any row number that has to do with the error message. For <u>UserError</u>s this could refer to a row in
a UI table or a multi-line form field, for example so that client-code can better identify the source of the error to the user.</p>
</article>
<article id="stack">
<b class="property"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">stack?: string</span>
<p>This contains the stack trace if available.</p>
</article>
<article id="technical">
<b class="property"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">technical?: string</span>
<p>If present, this should contain additional technical information that would be relevant to a software developer.</p>
</article>
<article id="toPlain">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">toPlain(): object</span>
<p>This returns a "Plain old JavaScript object" representation of this exception that is suitable for stringifying to JSON.</p>
</article>
<article id="toString">
<b class="method"></b>
<b class="server"></b>
<b class="client"></b>
<span class="sig">toString(): string</span>
<p>This returns <u>message</u>.</p>
</article>
</div>