News for hackers. Stuff that matters.
Re:Show HN: I built a Ruby gem that handles memoization with... by JamesSwift on Tuesday April 22, 2025 @03:31PM (#43765464)
I thought ruby would auto-wrap the original exception as long as you are raising from a rescue block (i.e. as long as $! is non-nil). So in that case you can just

  raise "Failed to execute memoized method '#{method_name}'"
And ruby will set `cause` for you

https://pablofernandez.tech/2014/02/05/wrapped-exceptions-in...

Re:Show HN: I built a Ruby gem that handles memoization with... by film42 on Wednesday April 23, 2025 @10:54AM (#43772916)
TIL! That's pretty cool. I still think if you have no reason to catch an error (i.e. state tracking, etc.) then you should not.