0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Workatoでレシピ内の途中の処理を強制的にエラーとするには

Posted at

Workatoで強制的にエラーを発生させたい場合は、Rubyコネクターを利用して対応します。
例えば、特定のHTTPステータスコードの場合にレシピをエラーにしたい場合はこの方法で対応可能です。

手順

1.レシピのアクションにRubyコネクターを追加します。

image.png

2.Inputに err_msg という変数を定義します。

この変数へエラーメッセージをセットします。
image.png

3.以下のコードを追加します。

Rubyコネクターでは、Inputで定義した変数を input['変数名'] で取得してコード内で利用することが出来ます。

error(input['err_msg'])

レシピ例

以下の場合は、3ステップ目でエラーメッセージを定義(セット)し、4ステップ目でエラーチェックを行い、5ステップ目でエラーを発生させます。

image.png

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?