Skip to content

Commit 1b26007

Browse files
committed
Update ErrorReference.md
1 parent 8308d0c commit 1b26007

1 file changed

Lines changed: 104 additions & 134 deletions

File tree

docs/JavaScript/ErrorReference.md

Lines changed: 104 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ These errors can be a helpful debugging your code, but the reported problem isn'
99

1010
### InternalError: string too long
1111

12+
- Occurs when length of string is over `((1 << 30) - 1)`.
13+
- This error should not occur if `script-watchdog-memory-limit` has not been modified.
14+
1215
### InternalError: out of memory
1316

1417
- This error occurs when the combined memory usage exceeds 250 megabytes.
@@ -19,7 +22,7 @@ These errors can be a helpful debugging your code, but the reported problem isn'
1922

2023
- Occurs when there is a recursive function (a function that calls itself) without an exit point.
2124

22-
- Example code:
25+
Example code:
2326

2427
```js
2528
function loop(x) {
@@ -31,228 +34,195 @@ loop(0);
3134
```
3235

3336
### InternalError: interrupted
37+
38+
- Occurs when runtime has a negligible cost.
3439

3540
### InternalError: invalid index for append
3641

37-
### InternalError: invalid ret value
42+
- There was an unexpected assignment somewhere.
43+
- Click [**here**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_assignment_left-hand_side) for more infomation.
44+
45+
<!-- ### InternalError: invalid ret value -->
3846

39-
### InternalError: iterator_close_return
47+
<!-- ### InternalError: iterator_close_return -->
4048

4149
### InternalError: too many local variables
4250

51+
- When the local variable indexes reaches above 16 bits.
52+
4353
### InternalError: too many arguments
4454

45-
### InternalError: unexpected ellipsis token
55+
- When the local variable indexes reaches above 16 bits.
56+
57+
<!-- ### InternalError: unexpected ellipsis token -->
4658

47-
### InternalError: too many closure variables
59+
<!-- ### InternalError: too many closure variables -->
4860

49-
### InternalError: invalid digit
61+
<!-- ### InternalError: invalid digit -->
5062

51-
### InternalError: out of memory in regexp execution
63+
<!-- ### InternalError: out of memory in regexp execution -->
5264

5365
### RangeError: invalid array length
66+
5467
- Occurs when specifying an array length that is either negative, a floating number or exceeds the maximum supported by the platform. [**Source**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length)
5568

56-
### RangeError: invalid array index
69+
<!-- ### RangeError: invalid array index -->
5770

5871
### RangeError: radix must be between 2 and 36
5972

60-
### RangeError: invalid number of digits
61-
62-
### RangeError: invalid code point
63-
64-
### RangeError: invalid repeat count
65-
66-
### RangeError: bad normalization form
67-
68-
### RangeError: Date value is NaN
69-
70-
### RangeError: invalid array buffer length
71-
72-
### RangeError: invalid offset
73-
74-
### RangeError: invalid length
75-
76-
### RangeError: invalid byteOffset
77-
78-
### RangeError: invalid byteLength
79-
80-
### RangeError: out of bound
73+
- This occurs when the optional radix parameter of the `Number.prototype.toString()` method was specified and is not between 2 and 36. [**Source**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Bad_radix)
8174

82-
### ReferenceError: unsupported reference to 'super### ReferenceError: 'this' can be initialized only once
75+
<!-- ### RangeError: invalid number of digits -->
8376

84-
### SyntaxError: unparenthesized unary expression can't appear on the left-hand side of ### SyntaxError: invalid regular expression flags
77+
<!-- ### RangeError: invalid code point -->
8578

86-
### TypeError: unsupported operation
79+
<!-- ### RangeError: invalid repeat count -->
8780

88-
### TypeError: invalid object type
89-
90-
### TypeError: not an object
91-
92-
### TypeError: not a symbol
93-
94-
### TypeError: object is not extensible
95-
96-
### TypeError: circular prototype chain
97-
98-
### TypeError: operand 'prototype' property is not an object
99-
100-
### TypeError: invalid 'instanceof' right operand
101-
102-
### TypeError: expecting \<brand> private field
103-
104-
### TypeError: invalid brand on object
105-
106-
### TypeError: no setter for property
107-
108-
### TypeError: could not delete property
109-
110-
### TypeError: toPrimitive
81+
<!-- ### RangeError: bad normalization form -->
11182

112-
### TypeError: cannot convert symbol to number
113-
114-
### TypeError: cannot convert symbol to string
115-
116-
### TypeError: null or undefined are forbidden
117-
118-
### TypeError: invalid 'in' operand
119-
120-
### TypeError: invalid property access
121-
122-
### TypeError: value is not iterable
83+
### RangeError: Date value is NaN
12384

124-
### TypeError: iterator must return an object
85+
- This exception occurs when the Date object contains an invalid date. [**Source**](https://stackoverflow.com/a/54462335)
12586

126-
### TypeError: parent class must be constructor
87+
```js
88+
new Date('undefined').toISOString()
89+
```
12790

128-
### TypeError: parent prototype must be an object or null
91+
<!-- ### RangeError: invalid offset -->
12992

130-
### TypeError: must be called with new
93+
<!-- ### RangeError: invalid length -->
13194

132-
### TypeError: not a function
95+
<!-- ### RangeError: invalid byteOffset -->
13396

134-
### TypeError: derived class constructor must return an object or undefined
97+
<!-- ### RangeError: invalid byteLength -->
13598

136-
### TypeError: class constructors must be invoked with 'new### TypeError: iterator does not have a throw method
99+
<!-- ### RangeError: out of bound -->
137100

138-
### TypeError: value has no property
101+
<!-- ### ReferenceError: unsupported reference to 'super' -->
139102

140-
### TypeError: not a constructor
103+
<!-- ### ReferenceError: 'this' can be initialized only once -->
141104

142-
### TypeError: not a generator
105+
<!-- ### SyntaxError: unparenthesized unary expression can't appear on the left-hand side of 'any' -->
143106

144-
### TypeError: cannot invoke a running generator
107+
### SyntaxError: invalid regular expression flags
145108

146-
### TypeError: not an AsyncGenerator object
109+
- Occurs when the flags in a regular expression contain any flag.
110+
- Click [**here**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Bad_regexp_flag) for more infomation.
147111

148-
### TypeError: import.meta not supported in this context
112+
<!-- ### TypeError: unsupported operation -->
149113

150-
### TypeError: no function filename for import### TypeError: bytecode function expected
114+
### TypeError: invalid object type
151115

152-
### TypeError: eval is not supported
116+
<!-- ### TypeError: not an object -->
153117

154-
### TypeError: circular reference
118+
<!-- ### TypeError: not a symbol -->
155119

156-
### TypeError: cannot convert to object
120+
<!-- ### TypeError: object is not extensible -->
157121

158-
### TypeError: invalid getter
122+
<!-- ### TypeError: circular prototype chain -->
159123

160-
### TypeError: invalid setter
124+
<!-- ### TypeError: operand 'prototype' property is not an object -->
161125

162-
### TypeError: cannot have setter/getter and value or writable
126+
<!-- ### TypeError: invalid 'instanceof' right operand -->
163127

164-
### TypeError: not a prototype
128+
<!-- ### TypeError: expecting \<brand> private field -->
165129

166-
### TypeError: proxy preventExtensions handler returned false
130+
<!-- ### TypeError: invalid brand on object -->
167131

168-
### TypeError: not a object
132+
### TypeError: no setter for property
169133

170-
### TypeError: Array loo long
134+
- This occurs when trying to set a new value to a property, for which only a getter is defined.
135+
- This is common when attempting to set property on native objects from native modules.
171136

172-
### TypeError: empty array
137+
### TypeError: could not delete property
173138

174-
### TypeError: Array too long
139+
- Click [**here**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Non_configurable_array_element) for more infomation.
175140

176-
### TypeError: not a number
141+
### TypeError: toPrimitive
177142

178-
### TypeError: not a boolean
143+
- Click [**here**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive) for more infomation.
179144

180-
### TypeError: not a string
145+
Example code:
181146

182-
### TypeError: regex not supported
147+
```js
148+
import("@minecraft/server").then(res => String(res))
149+
.catch(console.error);
150+
```
183151

184-
### TypeError: regexp must have the 'g' flag
152+
### TypeError: cannot convert symbol to number
185153

186-
### TypeError: string expected
154+
- occurs when attempting to convert a Symbol, to a number.
187155

188-
### TypeError: flags must be undefined
156+
### TypeError: cannot convert symbol to string
189157

190-
### TypeError: RegExp exec method must return an object or null
158+
- occurs when attempting to convert a Symbol, to a string.
191159

192-
### TypeError: revoked proxy
160+
<!-- ### TypeError: null or undefined are forbidden -->
193161

194-
### TypeError: proxy: inconsistent prototype
162+
<!-- ### TypeError: invalid 'in' operand -->
195163

196-
### TypeError: proxy: bad prototype
164+
<!-- ### TypeError: invalid property access -->
197165

198-
### TypeError: proxy: inconsistent isExtensible
166+
### TypeError: value is not iterable
199167

200-
### TypeError: proxy: inconsistent preventExtensions
168+
- This occurs when an iteration happens over a value that is not an iterable object.
169+
- Click [**here**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/is_not_iterable) for more infomation.
201170

202-
### TypeError: proxy: inconsistent has
171+
<!-- ### TypeError: iterator must return an object -->
203172

204-
### TypeError: proxy: inconsistent get
173+
<!-- ### TypeError: parent class must be constructor -->
205174

206-
### TypeError: proxy: inconsistent set
175+
<!-- ### TypeError: parent prototype must be an object or null -->
207176

208-
### TypeError: proxy: cannot set property
177+
### TypeError: must be called with new
209178

210-
### TypeError: proxy: inconsistent getOwnPropertyDescriptor
179+
- You must use `new` to create an instance of a user-defined object type or of one of the built-in object types that has a constructor function. [**Source**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new)
211180

212-
### TypeError: proxy: defineProperty exception
181+
### TypeError: not a function
213182

214-
### TypeError: proxy: inconsistent defineProperty
183+
- This occurs when there was an attempt to call a value from a function, but the value is not actually a function. [**Source**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_function)
215184

216-
### TypeError: proxy: inconsistent deleteProperty
185+
<!-- ### TypeError: derived class constructor must return an object or undefined -->
217186

218-
### TypeError: proxy: properties must be strings or symbols
187+
### TypeError: class constructors must be invoked with 'new'
219188

220-
### TypeError: proxy: duplicate property
189+
- You must use `new` to create an instance of a user-defined object type or of one of the built-in object types that has a constructor function. [**Source**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new)
221190

222-
### TypeError: proxy: target property must be present in proxy ownKeys
191+
<!-- ### TypeError: iterator does not have a throw method -->
223192

224-
### TypeError: proxy: property not present in target were returned by non extensible proxy
193+
### TypeError: value has no property
225194

226-
### TypeError: set/add is not a function
195+
- This occurs when you attempt to access properties of `null` and `undefined`. They don't have any. [**Source**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/No_properties)
227196

228-
### TypeError: promise self resolution
197+
### TypeError: not a constructor
229198

230-
### TypeError: resolving function already set
199+
- The value is not a class.
200+
- Read [**here**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Not_a_constructor) for more infomation.
231201

232-
### TypeError: not an Async-from-Sync Iterator
202+
<!-- ### TypeError: not a generator -->
233203

234-
### TypeError: not a Date object
204+
<!-- ### TypeError: cannot invoke a running generator -->
235205

236-
### TypeError: invalid hint
206+
<!-- ### TypeError: not an AsyncGenerator object -->
237207

238-
### TypeError: object needs toISOString method
208+
<!-- ### TypeError: import.meta not supported in this context -->
239209

240-
### TypeError: ArrayBuffer is detached
210+
<!-- ### TypeError: no function filename for import -->
241211

242-
### TypeError: cannot use identical ArrayBuffer
212+
<!-- ### TypeError: bytecode function expected -->
243213

244-
### TypeError: new ArrayBuffer is too small
214+
<!-- ### TypeError: eval is not supported -->
245215

246-
### TypeError: TypedArray length is too small
216+
### TypeError: circular reference
247217

248-
### TypeError: cannot be called
218+
- This occurs when object references to itself in a property. `JSON.stringify()` doesn't try to solve them and fails accordingly.
249219

250-
### URIError: expecting %%
220+
<!-- ### TypeError: cannot convert to object -->
251221

252-
### URIError: expecting hex digit
222+
<!-- ### TypeError: invalid getter
253223
254-
### URIError: malformed UTF-8
224+
### TypeError: invalid setter -->
255225

256-
### URIError: invalid character
226+
---
257227

258-
### URIError: expecting surrogate pair
228+
If you can't find the errors you want, put it in a search engine.

0 commit comments

Comments
 (0)