Error response middleware (text, json, html)