tock / ai.tock.bot.engine.nlp / NlpListener / error

error

open fun error(query: NlpQuery, dialog: Dialog, throwable: Throwable?): Unit (source)

Called when nlp request is throwing an error.

Using this method, you can for example redirect to a custom story which will handle the error.

object MyNlpListener : NlpListener {
 override fun error(query: NlpQuery, dialog: Dialog, throwable: Throwable?) {
  super.error(query, dialog, throwable)
  dialog.state.currentIntent = bot.myCustomErrorStory.mainIntent()
 }
}