> ## 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:validate

> 使用 arc:validate 在物件缺少必需屬性時擲回錯誤，並可配置錯誤程式碼和描述。

export const siteNameShort = "知行之橋";

可以使用 `arc:validate` 關鍵字在缺少必需值時擲回錯誤。

## 參數

* **item**：包含要驗證屬性的物件。
* **attr**：要驗證的屬性。如果該屬性不存在，則擲回錯誤。
* **code**：驗證失敗時要擲回的錯誤碼。預設值：`arc:validate`。
* **desc**：驗證失敗時要擲回的錯誤描述。預設訊息說明指定的屬性是必需的。

## 範例

如果 `_query` 物件不包含 `Id` 屬性，則擲回一條更具體的訊息：

```xml theme={null}
<arc:validate attr="_query.Id"   desc="The Id is required to delete."/>
```

## 另請參閱

* [arc:throw](./op-arc-throw)：從指令碼中擲回錯誤（例外）。
