Lists all errors that can be thrown by function implementations when executing this action.
output (HabitatPod) {
throws {
error (MultipleMatches) {
property (matches) {
type (HabitatPod)
min (Required)
max (Many)
}
on-catch {
replan {
intent {
goal { HabitatPod @prompt-behavior(AlwaysSelection) }
value { $expr(matches) }
}
}
}
}
}
}
action (GetResultReplan) {
type (Search)
description (This demonstrates how to replan on an error.)
output (Result) {
throws {
error (ErrorWhichCausesReplan) {
// When this error is caught, it will attempt to fulfill the goal for this action by
// running the intent given in `replan` below.
on-catch {
replan {
dialog("An error was caught, and now, we will replan to another way to get a Result.")
intent {
goal: Result
route: GetResult
}
}
}
}
}
}
}
action (FindShoeError) {
type (Search)
description (Show how to deal with HTTP errors.)
output (Shoe) {
throws {
error (ErrorWhichHalts) {
on-catch {
halt {
dialog("HTTP error was caught, and execution halted.")
}
}
}
}
}
}
For a complete example using throws
, see the Input Validation and Error Handling sample capsule.
error optional | Defines named, modeled errors with the required on-catch clause |
unknown-error optional | Defines an unknown error with a required on-catch clause |