A handy monkey-patch: Add to_xml to Ruby’s StandardError

While working on some error handler refactoring in a Rails app, I added this bit of code to my application controller (application.rb):

Then I found that the method StandardError#to_xml that I expected to be defined, actually was not. So I put this into an initializer:

Itch scratched!

Respond to this post