This bit me earlier this week when I wasn't paying enough attention and included some logic in my call() method *after* calling response_cb(). There are other explicit returns in the code samples here. I think it wouldn't hurt to make it obvious that response_cb()'s return value needs to be returned by the Middleware.
If this option isn't set, references to function arguments in the stack trace are retained. This can lead to destructors being called twice if an exception is thrown from a destructor, like in DBIx::Class::Storage::TxnScopeGuard, for example.
- Test that the original stack trace is printed when an exception is thrown and caught in a destructor (like DBIx::Class::Storage::TxnScopeGuard does). - Test that the original stack trace is printed when an exception is rethrown. Run all tests with strings and exception objects.
When multiple exceptions are thrown, store all stack traces either by refaddr or string value. Then try to find the trace matching the caught exception. Make sure to only store the first stack trace for each exception so that rethrown exceptions are ignored.
The content filter in ErrorDocument never set the $done variable to a true value in the non-subrequest case. As a result, it kept returning empty strings at the end of input, not undef like it should. This is actually harmless because response_cb copes with this behavior.