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

[FEATURE] More readable exception types #564

Open
mgovers opened this issue Apr 5, 2024 · 1 comment
Open

[FEATURE] More readable exception types #564

mgovers opened this issue Apr 5, 2024 · 1 comment
Labels
feature New feature or request good first issue Indicates a good issue for first-time contributors

Comments

@mgovers
Copy link
Member

mgovers commented Apr 5, 2024

Describe the feature request

Since C++20, the <format> STL functionality was introduced to improve string formatting:

  • more readable
  • less use of std::to_string (only when strictly necessary)
  • no unnecessary copying between stack and heap

This issue is about replacing the current PowerGridError and derived exceptions' constructor implementations with more readable patterns using formatted strings.

  • For static format patterns, std::format can be used
  • For format patterns that are not compile-time known, std::formatv needs to be used

The documentation on either is relatively clear, so it should not be a hard ticket to pick up.

@mgovers mgovers added feature New feature or request good first issue Indicates a good issue for first-time contributors labels Apr 5, 2024
@TonyXiang8787 TonyXiang8787 transferred this issue from PowerGridModel/power-grid-model-io Apr 5, 2024
@mgovers
Copy link
Member Author

mgovers commented Apr 5, 2024

It is possible that MacOS needs an additional feature flag before we can use this feature: https://github.com/PowerGridModel/power-grid-model/actions/runs/8570641564/job/23489029489

Note that according to https://en.cppreference.com/w/cpp/compiler_support/20 , the XCode version we use in CI for MacOS (15.2) should support it, so this result was unexpected. See also https://github.com/PowerGridModel/power-grid-model/actions/runs/8570641564/job/23489028931#step:5:36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue Indicates a good issue for first-time contributors
Projects
Status: No status
Development

No branches or pull requests

1 participant