Added error handling middleware and koalesce response type support.