-
Notifications
You must be signed in to change notification settings - Fork 40
add more ruby like rescues method #77
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestneeds docEverything is working, but documentation is needed.Everything is working, but documentation is needed.ready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branchInternal Use Only: Has been fixed, specs passing and pushed to edge branch
Milestone
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestneeds docEverything is working, but documentation is needed.Everything is working, but documentation is needed.ready-to-releaseInternal Use Only: Has been fixed, specs passing and pushed to edge branchInternal Use Only: Has been fixed, specs passing and pushed to edge branch
Type
Fields
Give feedbackNo fields configured for issues without a type.
The
after_errorhook (called error boundaries in React) is quite primitive.But we can use it to build a more ruby like
rescueshook:Like ruby
rescue, therescuesmethod can take a list of exception classes. If the error raised is an instance of one of the exception classes, the rescues block will catch the error, otherwise it will get passed down the stack to any components further up (down?) the tree.Like ruby
rescueyou can have severalrescuesin a component each with different blocks, or you can share the block with multiple exception classes.Like ruby
rescueif given no exception classrescueswill default toStandardErrorAlso
rescueswill automatically create the necessary wrapper classes, so that you can rescue errors raised in the component you are defining. This is not possible withafter_errorwhich can only catch errors raised in components mounted from within the component defining the boundary.