An error thrown while
Widget is renderingThe boundary catches the error thrown while Widget is rendering. Boundaries catch errors thrown during rendering, lifecycle methods and effects of their children.
The onClick option is the tempting wrong answer. Event handler errors happen outside rendering, so React cannot send them to a boundary. The same is true for a setTimeout callback. A boundary's own render errors go to the next boundary above it, not to itself.