ENH: Move UndefinedVariableError to error/__init__.py per GH27656
- [x] xref #27656. this GitHub issue is being done in multiple parts
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/v1.5.0.rst` file if fixing a bug or adding a new feature.

I made a tweak to scripts/pandas_errors_documented.py because it was flagging the `annotations` import not being in the testing.rst. I excluded __future__ module from the documentation check because the script's intent seems to be ensuring the custom pandas errors are documented. I also fixed a typo.

Thanks again!