Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No only Error for FallbackProps

See original GitHub issue

I’m using React-query, and we can type our error. But there is a conflit with react-error-boundary since the type is not an Error type, but a custom. How can we deal with that ?


  • react-error-boundary version: 3.1.0
  • node version: 12.19.1
  • npm version: 6.14.10

Relevant code or config

const OrderDetailsViews = (
  props: RouteComponentProps<TParams>
): React.ReactElement => {
  const { match } = props
  const { t } = useTranslation()
  const orderId = Number(
  const handleError = useErrorHandler()

  const { data: order, error, refetch: refetchOrders } = useQuery<
  >(['order-details', orderId], () => api.orders.findOneComplete(orderId), {
    onError: err => handleError(err) <-- ERROR TYPE

Suggested solution: We can pass our type like : handleError<ApiError>(err)


interface FallbackProps<T extends Error> { <-- We can pass something else
    error: T;
    resetErrorBoundary: (...args: Array<unknown>) => void;

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

kentcdoddscommented, May 5, 2021

And I would consider this a bug fix

tommariencommented, Apr 29, 2021

What is the need for it to be an error ? and not unknown like in node?

try {} catch(e: unknown){}

Also see #36 and #25

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Boundaries - React
Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them. Note. Error boundaries do not...
Read more >
reset error boundary on back journey using useErrorHandler ...
Provide a key to <ErrorBoundary /> . Whenever the key changes, the error boundary is reset. In your case, using useLocation().pathname as ...
Read more >
React Error Boundaries: Complete Guide - Meticulous
A complete guide to implementing React Error Boundaries, and how to use a third-party tool for handling more sophisticated scenarios.
Read more >
React Error Boundaries at the Granular Level
The aim is that if an error occurs, navigation should not be ... render() { const fallbackProps = { error: this.state.error, tryAgain: this....
Read more >
How to deal with failure in Redux connect ? | by Guillaume Wuip
fallbackProps . The props of a fallback component. If componentProps is there, render the component, if not, render the fallback. // let's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found