Fix CS errors and use correct exceptions
Merge pull request #4657 from bcrowe/3.0-CS

3.0 - Fix CS errors and use correct exceptions