Skip to content

Commit

Permalink
docs: Fix missing "Adding ErrorHandler" section
Browse files Browse the repository at this point in the history
Merge pull request #445 from hig3/patch-1
  • Loading branch information
nikhilym committed Aug 15, 2018
2 parents b5072f3 + 2bf9f0c commit 1dbd326
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/ja/Developing-Your-First-Skill.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,32 @@ SessionEndedRequestハンドラー
}
};
Errorハンドラーを追加する
---------------------

ASK SDK v2 for Node.js ではエラーハンドリングが改善されており、スキルはスムーズなユーザ体験を提供できます.
ハンドルされていないリクエスト, APIタイムアウトなどに対するあなたのエラー処理ロジックを追加するには、
ErrorHandler は適した場所です。
以下のサンプルでは、すべてのエラーをキャッチするハンドラーをスキルに追加することにより、いかなる種類のエラーに対してもスキルが意味のあるメッセージを返すことを保証しています。

以下のコードを\ ``index.js``\ ファイルの、前述のハンドラーの後に貼り付けます。

.. code:: javascript
const ErrorHandler = {
canHandle() {
return true;
},
handle(handlerInput, error) {
console.log(`Error handled: ${error.message}`);
return handlerInput.responseBuilder
.speak('Sorry, I can\'t understand the command. Please say again.')
.reprompt('Sorry, I can\'t understand the command. Please say again.')
.getResponse();
},
};
Lambdaハンドラーを作成する
----------------------------

Expand Down

0 comments on commit 1dbd326

Please sign in to comment.