QwikDev / qwik-evolution

Home for Qwik proposals and RFCs
15 stars 0 forks source link

[✨] ErrorBoundary #85

Closed mhevery closed 1 month ago

mhevery commented 1 year ago

Is your feature request related to a problem?

I would like to be able to intercept errors and render custom output.

Describe the solution you'd like

import { component$, useErrorBoundary } from '@builder.io/qwik';
import { ErrorBoundary } from '@builder.io/qwik-city';

export default component$(() => {
  const error = useErrorBoundary();
  return (
    <ErrorBoundary onError={(e) => <>ERROR: {e}</> }>
      <ProblemComponent />
    </ErrorBoundary>
  );
});

export const ProblemComponent = component$(() => {
  throw new Error('Component which throws error');
});

Describe alternatives you've considered

Qwik does not currently provide anything like this.

Additional context

No response

gioboa commented 1 month ago

We moved this issue to qwik-evolution repo to create a RFC discussion for this. Here is our Qwik RFC process thanks.