> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kasoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# arc:try

> 將 arc:try 與 arc:catch 結合使用，在指令碼中建立例外處理塊，以捕獲 try 主體中擲回的 RSBException。

export const siteNameShort = "知行之橋";

使用 `arc:try` 和 [arc:catch](./op-arc-catch) 關鍵字可以在指令碼中建立例外處理塊。如果 `arc:try` 主體內的任何關鍵字擲回 RSBException，應用程式會在相同範圍中查詢匹配的 `arc:catch` 關鍵字並執行 catch 主體。

## 參數

無

## 控制屬性

無

## 範例

擲回並捕獲例外。在關鍵字的範圍內，`arc:ecode` 和 `arc:emessage` 屬性會新增到當前物件中並推出。

```xml theme={null}
<arc:call op="...">
  <arc:try>
    <arc:throw code="myerror" description="thedescription" details="Other Details."/>
    <arc:catch code="myerror">
      <arc:set attr="arc:ecode" value="[_code]"/>
      <arc:set attr="arc:emessage" value="[_description]: [_details]"/>
      <arc:push/>
    </arc:catch>
  </arc:try>
</arc:call>
```

## 另請參閱

* [arc:catch](./op-arc-catch)：處理擲回的例外。
* [arc:throw](./op-arc-throw)：強制擲回例外。
