Handling Errors

Errors are handled by the <View> component, which has an handleError method stored the view context. You should always use a try...catch statement around any code that may encounter an error. Inside your catch method, you can then call the view error handler and pass the error object.

try {
...
}
catch (err){
‚Äč
this.context.handleError(err);
}

This will display a banner notification along the top of the view, with the error message text.