1

When the user says "read john 3:100", I have a ReadBibleVerse action that matches book:john, chapter:3, verse:100. The endpoint will return a 404, since there is no verse 100.

I want that action to capture the error and replan to a "read chapter" request, passing along book:john and chapter:3.

What I have...

action (ReadBibleVerse) {
  collect {
    input (book) {…}
    input (chapter) { type (ChapterNum) … }
    input (verse) {…}
  }
  output (Scripture) {
    throws {
      unknown-error {
        on-catch {
          replan {
            dialog ("Unknown verse, trying the chapter.")
            intent {
              goal: Scripture
              route: ReadBibleChapter
}}}}}}}

…what I get is "Unknown verse, trying the chapter. I need a book to continue."

I'm clearly hitting the error and, I believe, being "replanned" to ReadBibleChapter, but I'm also getting "I need a book to continue." because I need to explicitly pass along book and chapter?

I found intent.value, which appears to solve my problem, except I can't seem to find the correct format:

  • value: ChapterNum
  • value: ChapterNum (chapter)
  • value: [namespace].ChapterNum { $expr(chapter) }
  • more various nonsense
Timothy Aaron
  • 3,059
  • 19
  • 22

1 Answers1

1

This should work value {$expr(chapter)}

  • I assume you mean `value: {$expr(chapter)}`? But I get a couple errors with that format: `invalid type name: '', not a structure type: null` ChapterNum is a primitive (int), so do you mean `value: ChapterNum({$expr(chapter)})`? That tells me I'm _missing closing ")"_ – Timothy Aaron Aug 06 '19 at 20:36
  • Whatthe... ok, so I tried it (despite being obviously wrong format), and it worked. Documentation says a `:` is needed—and I'm super confused as it why it's not. – Timothy Aaron Aug 06 '19 at 20:45
  • I have not tried this but value: $expr(chapter) *should* work too. This area of documentation needs a bit of additional information to make it clearer. We will work on getting this included. – BixbyDevSupportOne Aug 06 '19 at 21:46
  • OR value: ChapterNum{$expr(chapter)} should work too. – BixbyDevSupportOne Aug 06 '19 at 21:52
  • i just get `Error: Not a structure type: ChapterNum` – Timothy Aaron Aug 06 '19 at 22:22
  • You can use value-set: ChapterNum{$expr(chapter)} for that one. – Pete Haas Aug 07 '19 at 00:20