I have one thing that I know, and one that is just a wild hunch.
I know that you do not need to call to_s in the general expression #{} ; this will happen automatically. But it does not harm.
My wild guess is that your test case doesnβt actually run the code you posted. What happens if you change e to f ?
I must point out that saving the Exception itself is usually bad. You should save RuntimeError or StandardError at the highest, and preferably something more specific. You can get some rather strange errors when saving exceptions because you interfere with threads and events at the interpreter level.
source share