Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Error Message

Yuichi Morimichi edited this page Sep 14, 2018 · 1 revision

Error Response

If an error occurs, it is necessary to return the appropriate error message to the user according to the CEK response format. This page describes how to set the message to be returned when an exception occurs.

Message Properties

File Location

Error messages are defined in the properties file.
The way to define the location of the properties file is the same as Spring.

The following is an example of the settings in file i18n/output-speech.properties.

spring:
  messages:
    basenames: i18n/output-speech

Localized files such as i18n/output-speech_en.properties are also eligible. Language defaults to Japanese, but you can change it with cek.client.default-locale.

NOTE: If you only set up i18n/output-speech_en.properties with the above settings, the error message will not correctly apply. To prepare a localized file, also create i18n/output-speech.properties, which may be left blank.

Message Definition

Error messages are defined with {exception class name}.brief. An example is shown below.

com.linecorp.clova.extension.boot.exception.MissingSlotException.biref=\
  I can not catch it.
java.lang.Throwable.brief=\
  An error occurred. Please try again later.

If the key corresponding to the exception is not found, look up the message with the parent class of the exception as the key. It is done recursively. By doing this, the definition of java.lang.Throwable.brief will always be a way to return an error message.

If you can not find the best message definition, the Clova device will silently end the skill, so be sure to define it.