devboard icon indicating copy to clipboard operation
devboard copied to clipboard

Better error handling?

Open glenjamin opened this issue 9 years ago • 2 comments

react-transform-catch-errors only applies to user code - not modules.

This means that when making errors inside a devcard while developing them, errors leak out.

I'm not sure yet whether this is only really a problem because it's in dev.

The component tree looks a bit like this:

  • Devcards
    • DevcardNamespace
      • Devcard
        • Actual card body
          • Component being developed

But error transforms are only applied at the bottom.

I think it might be preferrable to redbox individual cards. Rather than using https://github.com/KeywordBrain/redbox-react - which takes over the whole page, I think we should only redbox up to the card boundary.

glenjamin avatar Jan 21 '16 23:01 glenjamin

I originally tried to use redbox as a component, but you can't just try..catch in render(), so that didn't work.

I then had a go with https://github.com/facebook/react/issues/2461 - the new core feature for error boundaries, but it isn't finished yet.

I'm going to put this back on ice for now. It's possible to write an error catcher component that would communicate with the parent card - but that's a bit fiddly so I think i'll wait and see what 0.15 looks like before going down that route.

glenjamin avatar Jan 24 '16 22:01 glenjamin

Yes this is probably better to wait for 0.15. I am not sure we could design something that would not end up hacky.

Yomguithereal avatar Jan 24 '16 22:01 Yomguithereal