---
schema_version: "1"
id: 56a569ed1be07d61fdb3c6145c74e4873edf92c97ad0b786b005b2e47f8cf38b
title: fail
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-runtime-functions-fail.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-runtime-functions-fail
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 77fe363df155c0e0a589f6929c9ea2ba058035705df666fff99e00262e8de391
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
# fail

## [](#fail1)fail(message: String = 'Error'): Nothing

指定されたメッセージと共に例外をスローします。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>message</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">エラーメッセージ (​<code>String</code>​)。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、式 ​`(sizeOf(myVar) <= 0)`​ が ​`true`​ であるため、失敗メッセージ ​`Data was empty`​ を返します。エラーメッセージの短縮バージョンが出力で示されています。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::Runtime
var result = []
output application/json
---
if(sizeOf(result) <= 0) fail('Data was empty') else result
```

#### [](#出力)出力

```TXT
ERROR 2018-07-29 11:47:44,983 ...
*********************************
Message               : "Data was empty
...
```