added error handling to statsd middleware