Skip to content

TryStatement

A try statement.

import { TryStatement } from "@alloy-js/typescript";
<TryStatement >
{children}
</TryStatement>
childrenChildren
<TryStatement>
  // risky operation
</TryStatement>
<CatchClause parameter="error">
  console.error(error);
</CatchClause>

renders to

try {
  // risky operation
} catch (error) {
  console.error(error);
}