Add some error reporting middleware