Stencil version:
@stencil/core@latest
I'm submitting a:
[ ] bug report
[X] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
Whenever the developer wants to catch an error, we have to add try-catch blocks everywhere around the code in order to find issues.
Expected behavior:
Whenever an error happens in any part within the component, there should be a way to catch it by default and to do a custom error validation
import { Catch, Component, h } from '@stencil/core'
// Importing some custom error reporter that anyone has
import { reportError } from './myStuff';
@Component({
tag: 'my-component'
})
export class MyComponent {
@Catch
_handleErrors(exception) {
reportError(exception)
}
render() {
return <div>Whatever</div>
}
}
Steps to reproduce:
Related code:
// insert any relevant code here
Other information:
@micheltobon What do you think about keeping consistency and define the function in this way componentDidCatch(error: Error): void as part of lifecycle?
I think it works perfectly as well
Most helpful comment
@micheltobon What do you think about keeping consistency and define the function in this way
componentDidCatch(error: Error): voidas part of lifecycle?