react-router-guards icon indicating copy to clipboard operation
react-router-guards copied to clipboard

[Breaking] Use error object

Open joshpensky opened this issue 3 years ago • 0 comments

Description

Previously, we only ever surfaced the error message. As pointed out by #44, we should return the full object instead of just the message! That way the user can have full context of their errors when rendering the error page

This is a breaking change and should be released with 2.0.0

Related issues

Builds on top of #84 to resolve #44

What this does

  • Removes RouteError type in favor of unknown (since we don't know what kind of error is thrown!)
  • Update route error state management in Guard component
  • Updates intermediate demo + docs example to use instanceof Error check

How to test

  1. Visit a Missingno page on the deployed app (e.g., /test)
  2. Confirm the error message still appears as expected

joshpensky avatar Sep 14 '21 19:09 joshpensky