const boundary = new ErrorBoundary({
onError: (error) => {
console.error("Caught error:", error);
},
fallback: () => {
return { error: true, message: "Something went wrong" };
}
});
const result = await boundary.execute(async () => {
return await riskyOperation();
});