OnError
Annotate a method inside your component with @OnError to receive a callback when an exception inside supported delegate methods of a child component happens. You then get a chance to either trigger a state update or reraise the exception using ComponentUtils.raise
.
The method will receive a ComponentContext, and an Exception.
An example use may look like this:
@OnError
static Component onError(
ComponentContext c,
Exception e,
@Prop SomeProp prop) {
MyComponent.updateErrorAsync(c, String.format("Error for %s: %s", prop, e.getMessage()));
}
Content copied to clipboard