Skip to content

Conversation

@johnfairh
Copy link
Owner

The try! in RbException.description is a landmine - reliably fails if Ruby is messed up, easiest way to recreate is to remove the RUBY_INIT_STACK call. It turns out Swift itself calls description for try! via swift_UnexpectedError. We get:

  1. try! require(‘set’) (or whatever)
  2. Ruby fails with errinfo set
  3. RbVM.doProtect() -> RbError.raise() does throw
  4. Swift calls error.description
  5. RbError.description -> RbExn.description -> try! call(‘class’)
  6. Generates a new error, back to step 4

Fixes #55, #58

@codecov
Copy link

codecov bot commented Feb 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.01%. Comparing base (2e6ea2a) to head (d0b96ad).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #60   +/-   ##
=======================================
  Coverage   97.01%   97.01%           
=======================================
  Files          22       22           
  Lines        2141     2141           
=======================================
  Hits         2077     2077           
  Misses         64       64           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@johnfairh johnfairh merged commit eddacde into main Feb 10, 2025
9 checks passed
@johnfairh johnfairh deleted the recursive-error branch February 10, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recursive exception handling

2 participants