Bug 13764 – std.getopt: throw an UnknownOptionException rather than Exception

Status
REOPENED
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-11-22T13:13:26Z
Last change time
2024-12-01T16:23:03Z
Assigned to
No Owner
Creator
Danny Milosavljevic
Moved to GitHub: phobos#10101 →

Comments

Comment #0 by danny.milo — 2014-11-22T13:13:26Z
It would be nice if std.getopt would throw something like an UnknownOptionException rather than the very nondescript Exception it does now. As it is now, it's hard to tell harmless "user errors" from serious internal errors. Also, having to use string matching to find out which it is isn't so nice.
Comment #1 by danny.milo — 2014-11-25T11:17:37Z
It's already fixed in git phobos master, there's a GetOptException now. Still have to do string comparison to find out what happened (required option missing vs. unrecognized option). Oh well.
Comment #2 by hsteoh — 2014-11-25T15:18:56Z
I think this is a worthwhile enhancement request. Reopening.
Comment #3 by rburners — 2015-01-03T17:02:02Z
I will make that PR
Comment #4 by rburners — 2015-01-04T20:13:13Z
this is fixed
Comment #5 by john.loughran.colvin — 2016-01-31T14:10:59Z
Not quite, there is still a raw enforce in handleOption (https://github.com/D-Programming-Language/phobos/blob/master/std/getopt.d#L703)
Comment #6 by robert.schadek — 2024-12-01T16:23:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10101 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB