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

More detailed error message for SystemError exceptions #6756

Merged
merged 3 commits into from
Jun 30, 2023

Conversation

ironage
Copy link
Contributor

@ironage ironage commented Jun 28, 2023

Issues like #6739 would be much easier to diagnose if the reported exception message had the details about what the error code was. The std error code was already stored there, so this change just appends the details to the existing message.

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed.

@ironage ironage self-assigned this Jun 28, 2023
@cla-bot cla-bot bot added the cla: yes label Jun 28, 2023
@michael-wb
Copy link
Contributor

It looks like the expected error for the "Disabled user results in a sync error" test (test/object-store/sync/app.cpp:2874) needs to be updated as well.

Copy link
Member

@nicola-cab nicola-cab left a comment

Choose a reason for hiding this comment

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

LGTM, provided CI does not complain :-)

{
std::error_code err = std::make_error_code(std::errc::too_many_files_open);
std::string_view message = "my message";
std::string expected = util::format("%1 (SystemError %2: %3)", message, err.value(), "Too many open files");
Copy link
Member

Choose a reason for hiding this comment

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

CHECK_STRING_CONTAINS(e.what(), expected) failed with (my message (SystemError 24: too many files open), my message (SystemError 24: Too many open files)) ... Only on Windows though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Windows seems to provide a slightly different error message, so I've adjusted the tests accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course Windows just has to be different

Copy link
Contributor

@michael-wb michael-wb left a comment

Choose a reason for hiding this comment

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

Looks good now that all the tests are passing.

{
std::error_code err = std::make_error_code(std::errc::too_many_files_open);
std::string_view message = "my message";
std::string expected = util::format("%1 (SystemError %2: %3)", message, err.value(), "Too many open files");
Copy link
Contributor

Choose a reason for hiding this comment

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

Of course Windows just has to be different

@ironage ironage merged commit 655e49d into master Jun 30, 2023
@ironage ironage deleted the js/exception-info branch June 30, 2023 00:03
nicola-cab pushed a commit that referenced this pull request Jul 12, 2023
* a more detailed error message for SystemError exceptions

* update error message

* fix windows message
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants