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

Adapt Raise to use format string as message directly if no args are given #1606

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

muhammadhamzasajjad
Copy link
Collaborator

@muhammadhamzasajjad muhammadhamzasajjad commented Jun 8, 2024

Fixes https://github.com/man-group/arcticdb-man/issues/111

raise<ErrorCode>() function takes format string as the first argument. In some places this has been used incorrectly which leads errors like https://github.com/man-group/arcticdb-man/issues/111.

  • Adapt Raise to use format string as message directly if no args are given
  • To test this, pass sym{} as symbol name
  • Show symbol name as part of error message in mock clients. This will test whether sym{} is handled correctly.

Checklist

Checklist for code changes...
  • Have you updated the relevant docstrings, documentation and copyright notice?
  • Is this contribution tested against all ArcticDB's features?
  • Do all exceptions introduced raise appropriate error messages?
  • Are API changes highlighted in the PR description?
  • Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?

@muhammadhamzasajjad muhammadhamzasajjad self-assigned this Jun 11, 2024
@muhammadhamzasajjad muhammadhamzasajjad added the bug Something isn't working label Jun 11, 2024
@muhammadhamzasajjad muhammadhamzasajjad marked this pull request as ready for review June 11, 2024 14:22
@muhammadhamzasajjad muhammadhamzasajjad changed the title Correcty use format string where raise<ErrorCode>() is called Adapt Raise to use format string as message directly if no args are given Jun 13, 2024
@@ -24,7 +24,13 @@ struct Raise {
template<typename...Args>
[[noreturn]] void operator()(fmt::format_string<Args...> format, Args&&...args) const {
std::string combo_format = fmt::format(FMT_COMPILE("{} {}"), error_code_data<code>.name_, format);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combo_format should be moved inside the else both here and below

@muhammadhamzasajjad muhammadhamzasajjad merged commit 2a92cfe into master Jun 21, 2024
110 of 111 checks passed
@muhammadhamzasajjad muhammadhamzasajjad deleted the raise_formatter_update branch June 21, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants