JamesSwift 5 days ago

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...

1
film42 4 days ago

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.