Fix bugs and clean up messages in error reporting

Fix bugs in error reporting vs exception handling (some errors were
being displayed more like exceptions).  Improved error messages for
attempts to do unauthorized actions.

Cleaned up some comments, removed some commented-out code, added a few
extra error checks.