react-live icon indicating copy to clipboard operation
react-live copied to clipboard

Add `onError` prop to LiveProvider

Open pajter opened this issue 6 years ago • 4 comments

I need a way to get the Error object instead of just rendering it through <LiveError />. I couldn't find a way to do this so I thought I'd add simple onError + onRender props to LiveProvider. Devs can then set these handlers if they want to do some custom error handling.

Please let me know if I missed anything or if you don't feel this is a good addition.

pajter avatar Sep 11 '19 11:09 pajter

I think onError is a good addition! What was the use case for the onRender prop? It seems like you didn't add documentation for it. I'm wondering if there's something we already have that might cover that added functionality?

sofiapoh avatar Sep 25 '19 14:09 sofiapoh

Just added some more fixes. Forgot about this PR for a while, sorry!

The onRender prop will be called when the error is cleared. You'd need to have some way to know when there is no longer an error. Maybe another name could be better.

I do need to add documentation, agreed!

pajter avatar Sep 25 '19 15:09 pajter

@sofiapoh I removed onError and changed onRender to include an optional Error argument. I'd love to get your thoughts on this.

pajter avatar Oct 21 '19 09:10 pajter

This is a great addition. Any update here?

S33G avatar Mar 11 '22 14:03 S33G