Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name argument if data conversion fails in std.getopt #10593

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

burner
Copy link
Member

@burner burner commented Dec 19, 2024

Fixes #9662

revival of #3491 as the suggested "better" solution never happened

@burner burner requested a review from andralex as a code owner December 19, 2024 16:34
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @burner!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

  • In preparation for migrating from Bugzilla to GitHub Issues, the issue reference syntax has changed. Please add the word "Bugzilla" to issue references. For example, Fix Bugzilla Issue 12345 or Fix Bugzilla 12345.(Reminder: the edit needs to be done in the Git commit message, not the GitHub pull request.)

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#10593"

@thewilsonator
Copy link
Contributor

Enforce whitespace before opening parenthesis
grep -nrE "\<(for|foreach|foreach_reverse|if|while|switch|catch|version)\(" $(find etc std -name '*.d') ; test $? -eq 1
std/getopt.d:622:    catch(ConvException e)
std/getopt.d:2006:    catch(GetOptException e)
std/getopt.d:2028:    catch(GetOptException e)

@burner burner force-pushed the issue9662_getopt_nicer_conv_error branch from 7735b46 to 6f6fd6e Compare December 20, 2024 07:25
@burner
Copy link
Member Author

burner commented Dec 20, 2024

@thewilsonator thank you

@thewilsonator
Copy link
Contributor

Looks like this breaks tsv-utils with the change of exception type. cc @jondegenhardt

thewilsonator added a commit to thewilsonator/tsv-utils that referenced this pull request Dec 30, 2024
dlang/phobos#10593 changes the thrown exception type from `ConvException` to `GetOptException` to provide more context on failed conversion.
@thewilsonator
Copy link
Contributor

eBay/tsv-utils#360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std.getopt: improve error message for malformed arguments
3 participants