http://d.puremagic.com/issues/show_bug.cgi?id=5228


Andrej Mitrovic <andrej.mitrov...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrov...@gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrov...@gmail.com> 2011-05-24 
20:23:44 PDT ---
It can also throw a UnicodeException. Even for things like this:

main.exe -

A single slash throws: core.exception.UnicodeException@(1244708): invalid UTF-8
sequence

This should really be wrapped in some kind of a getopt exception. 

I'd further add that appart from getting some information on which option
failed to parse, getopt might try to figure out what went wrong in other
situations and create a custom exception message based on it. For example if
you just pass a single dash getopt would throw GetOptException("Failed to
provide an argument after single dash."), and you could either catch this and
ignore it, or display it to the user:

void main()
{
    try { // parse args }
    catch (GetOptException exc)
    {
        writeln(exc.toString);  // tell the user what went wrong, 
                                // but maybe continue operating
    }
}

Anywho, +1 for the enhancement.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to