Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include option to pass in fallback UI component into ExceptionlessErrorBoundary #102

Closed
polluterofminds opened this issue Sep 1, 2021 · 3 comments

Comments

@polluterofminds
Copy link
Contributor

In the current implementation, the ExceptionlessErrorBoundary works really well for capturing UI-level errors in the components. However, one of the benefits of Error Boundaries in React is the ability to render a fallback component when there is a component-level error. In order to do that alongside the ExceptionlessErrorBoundary, you have to write code that looks like this:

ReactDOM.render(
  <React.StrictMode>
    <ErrorBoundary>
      <ExceptionlessErrorBoundary>
        <App />
      </ExceptionlessErrorBoundary>
    </ErrorBoundary>
  </React.StrictMode>,
  document.getElementById('root')
);

Having to create your own Error Boundary class component just to render a fallback image feels tedious and repetitive. It would be nice if the ExceptionlessErrorBoundary took an optional component prop that could be used to render a fallback. Something like this:

ReactDOM.render(
  <React.StrictMode>
      <ExceptionlessErrorBoundary fallbackComponent={ErrorUI}>
        <App />
      </ExceptionlessErrorBoundary>
  </React.StrictMode>,
  document.getElementById('root')
);
@niemyjski
Copy link
Member

We could do this, but my counter argument is if you want to remove Exceptionless, now you have to create the error boundary anyways and redo the ui instead of removing two lines of code. I kinda like being transparent and single responsibility (of just capturing the errors, not doing many things), thoughts?

@polluterofminds
Copy link
Contributor Author

Yeah, that's a fair argument. I don't have a super strong opinion. I just felt like it was tedious when I was setting this up and it seemed like a nice (optional) bonus for people to have.

@niemyjski
Copy link
Member

Let's close this until it's requested by a few end users. If you are reading this and like this upvote and leave a comment :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants