middleware error handling test