Skip to content

tshwara

Handles errors raised inside the preceding leka block.

Use tshwara immediately after a leka block. The parenthesised binding (e.g. (e)) receives the thrown value so your code can inspect or report it. If no error occurs in the leka block, the tshwara block is skipped.

leka { ... } tshwara (lebitso) { ... }
Log a caught error to the console
leka {
  latlha "phoso";
} tshwara (e) {
  kwala(e);
}

leka, kgabagare, latlha