by film42 · 1y ago · 0 comments
Only suggestion is to not wrap the error of the caller in your memo wrapper.
> raise MemoTTL::Error, "Failed to execute memoized method '#{method_name}': #{e.message}"
It doesn't look like you need to catch this for any operational or state tracking reason so IMO you should not catch and wrap. When errors are wrapped with a string like this (and caught/ re-raised) you lose the original stacktrace which make debugging challenging. Especially when your error is like, "pg condition failed for select" and you can't see where it failed in the driver.
raise "Failed to execute memoized method '#{method_name}'"
And ruby will set `cause` for youhttps://pablofernandez.tech/2014/02/05/wrapped-exceptions-in...