add more ruby like rescues method #77
Labels
enhancement
New feature or request
needs doc
Everything is working, but documentation is needed.
ready-to-release
Internal Use Only: Has been fixed, specs passing and pushed to edge branch
Milestone
The
after_error
hook (called error boundaries in React) is quite primitive.But we can use it to build a more ruby like
rescues
hook:Like ruby
rescue
, therescues
method 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
rescue
you can have severalrescues
in a component each with different blocks, or you can share the block with multiple exception classes.Like ruby
rescue
if given no exception classrescues
will default toStandardError
Also
rescues
will automatically create the necessary wrapper classes, so that you can rescue errors raised in the component you are defining. This is not possible withafter_error
which can only catch errors raised in components mounted from within the component defining the boundary.The text was updated successfully, but these errors were encountered: