Strip spaces for the 1000th time.
Fix Issue 5228 - Add a GetoptException and document which exceptions are thrown.
Merge pull request #2048 from AndrejMitrovic/Fix5228

Issue 5228 - Add GetOptException and document exceptions