choojs / nanocomponent

🚃 - create performant HTML components
https://leaflet.choo.io/
MIT License
366 stars 30 forks source link

Error boundries #43

Open yoshuawuyts opened 7 years ago

yoshuawuyts commented 7 years ago

In React 16 components introduce something new called error boundries. The main idea is that if an error is thrown from a component, it can be caught early, and prevents crashing the whole web page.

I find this interesting because:

  1. it means apps can keep running even if a component crashes (resiliency! :D)
  2. it'll play well with component.use (or similar); can send through the error to a local dev logger, or monitoring solution
  3. it's especially good to add resiliency when encapsulating 3rd party code - ideally code would never crash, but alas code isn't bug free

Thoughts?

bcomnes commented 7 years ago

How does this work? Wrap stuff in try catch?

bcomnes commented 7 years ago

I like the idea though.

yoshuawuyts commented 7 years ago

Wrap stuff in try catch

yeah, pretty much haha

ungoldman commented 7 years ago

I saw this on twétèr and thought the idea was interesting too. Would this be something baked in to nanocomponent or could it be maintained as a standalone module?

yoshuawuyts commented 7 years ago

Think having it be part of NC would be good - isolates a class of errors / unlike servers you'll most likely never want a full page to crash

On Mon, Aug 7, 2017, 19:33 Nate Goldman notifications@github.com wrote:

I saw this on twétèr and thought the idea was interesting too. Would this be something baked in to nanocomponent or could it be maintained as a standalone module?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/choojs/nanocomponent/issues/43#issuecomment-320728704, or mute the thread https://github.com/notifications/unsubscribe-auth/ACWlejQZJMKloyjeZlNo6AAm8tGooAhzks5sV0pRgaJpZM4OvmfY .