> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/debug/handling/throw.md).

# throw

🚧 under construction

* [JS](/web/js.md) ⟩ [statement](/web/js/grammar/statement.md) ⟩ [control flow](/web/js/grammar/statement/flow.md) ⟩ [jump](/web/js/grammar/statement/flow/jump.md) ⟩ throw
* [JS](/web/js.md) ⟩ [error](/web/js/err.md) ⟩ [handling](/web/js/debug/handling.md) ⟩ throw&#x20;

{% hint style="success" %}
([statement](/web/js/grammar/statement.md))&#x20;

<mark style="color:yellow;">**exceptions**</mark> are <mark style="color:yellow;">**thrown**</mark>&#x20;

* whenever a [<mark style="color:red;">**runtime error**</mark>](/web/js/err/runtime.md) <mark style="color:yellow;">**occurs**</mark>&#x20;
* and whenever the program <mark style="color:red;">**explicitly**</mark> <mark style="color:yellow;">**throws**</mark> one using the <mark style="color:purple;">**throw**</mark> <mark style="color:yellow;">**statement**</mark>.&#x20;

<mark style="color:yellow;">**exceptions**</mark> are <mark style="color:yellow;">**caught with**</mark> [try-catch-finally](/web/js/debug/handling/try-catch-finally.md) <mark style="color:yellow;">**statement**</mark>.

```javascript
throw <expr>
```

{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}

* [error handling](/web/js/debug/handling.md)
* [try-catch-finally](/web/js/debug/handling/try-catch-finally.md)
  {% endtab %}

{% tab title="📗 參考" %}

* [JavaScript: The Definitive Guide](/web/master/ref/javascript-the-definitive-guide.md) ⟩ 5.5.6 throw
  {% endtab %}

{% tab title="📘 手冊" %}

* [throw](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw)
  {% endtab %}
  {% endtabs %}
