Simplify error handling for anonymous user

The error message is usually not useful at all and this code causes
false positive in current PyLint.