In this post we saw how to construct a very simple Rack application with some Middleware.
Now, we’re going to raise an exception in MessageApp and rescue it in the MessageSetter middleware which sits one level up in the application stack.
When running the application now you get “CAUGHT” printed to your server readout and “Hello, World! (caught an exception along the way!)” rendered in the viewport.