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

Print error message in FMT_THROW when exception is disabled #2145

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

NobodyXu
Copy link
Contributor

@NobodyXu NobodyXu commented Feb 22, 2021

Currently, if exception is disabled, an error in fmt will result a termination via FMT_ASSERT, but there is no error message printed on stderr, so it can be a little bit confusing for the user on why the program failed.

This PR modifies FMT_THROW to pass exception.what() to FMT_ASSERT as the error message.

Although it doesn't provide more information which part of format string caused the error, it is better than printing no error message at all.

Signed-off-by: Jiahao XU Jiahao_XU@outlook.com

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@NobodyXu NobodyXu changed the title Print x.what() of FMT_THROW when exception is disabled Print error message in FMT_THROW when exception is disabled Feb 22, 2021
@vitaut vitaut merged commit 640acba into fmtlib:master Feb 24, 2021
@vitaut
Copy link
Contributor

vitaut commented Feb 24, 2021

Thank you!

sthagen added a commit to sthagen/fmtlib-fmt that referenced this pull request Feb 24, 2021
Print x.what() of FMT_THROW when exception is disabled (fmtlib#2145)
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.

2 participants