--- title: InternalError slug: Web/JavaScript/Reference/Global_Objects/InternalError tags: - InternalError - 内部错误 translation_of: Web/JavaScript/Reference/Global_Objects/InternalError --- <div>{{JSRef}} {{non-standard_header}}</div> <p><strong><code>InternalError</code> 对象</strong>表示出现在JavaScript引擎内部的错误。 例如: <strong>"InternalError</strong>: too much recursion"(内部错误:递归过深)。</p> <h2 id="语法">语法</h2> <pre class="syntaxbox"><code>new InternalError([<var>message</var>[, <var>fileName</var>[, <var>lineNumber</var>]]])</code></pre> <h3 id="参数">参数</h3> <dl> <dt><code>message</code></dt> <dd>可选。 人类可读的错误描述信息。</dd> <dt><code>fileName</code> {{non-standard_inline}}</dt> <dd>可选。触发该错误的代码所在文件的文件名。</dd> <dt><code>lineNumber</code> {{non-standard_inline}}</dt> <dd>可选。触发该错误的代码所在的代码行号。</dd> </dl> <h2 id="描述">描述</h2> <p>当JavaScript引擎出现内部错误时将会抛出<code>InternalError。</code></p> <p>示例场景通常为某些成分过大,例如:</p> <ul> <li>"too many switch cases"(过多<code>case</code>子句);</li> <li>"too many parentheses in regular expression"(正则表达式中括号过多);</li> <li>"array initializer too large"(数组初始化器过大);</li> <li>"too much recursion"(递归过深)。</li> </ul> <h2 id="属性">属性</h2> <dl> <dt>{{jsxref("InternalError.prototype")}}</dt> <dd>允许向<code>InternalError</code>对象添加属性。</dd> </dl> <h2 id="方法">方法</h2> <p>全局 <code>InternalError</code> 对象自身不包含任何方法,但从原型链中继承了一些方法.</p> <h2 id="InternalError_实例"><code>InternalError</code> 实例</h2> <h3 id="属性_2">属性</h3> <div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError/prototype', '属性')}}</div> <h3 id="方法_2">方法</h3> <div>{{page('/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError/prototype', '方法')}}</div> <h2 id="规范">规范</h2> <p>尚未成为任何规范的一部分。</p> <h2 id="浏览器兼容性">浏览器兼容性</h2> <h2 id="CompatibilityTable"><span style="font-size: 14px; font-weight: normal; line-height: 1.5;">{{CompatibilityTable}}</span></h2> <div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari</th> </tr> <tr> <td>基本支持</td> <td>{{CompatNo}}</td> <td>{{CompatVersionUnknown}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> </tr> </tbody> </table> </div> <div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Chrome for Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>基本支持</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> <td>{{CompatVersionUnknown}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> <td>{{CompatNo}}</td> </tr> </tbody> </table> </div> <h2 id="相关链接">相关链接</h2> <ul> <li>{{jsxref("Error","错误")}}</li> <li>{{jsxref("InternalError.prototype")}}</li> </ul>