Fix Issue 5228 - Add a GetoptException and document which exceptions are thrown.