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

Trace Exporter should respect noexcept qualifiers #11288

Closed
dbolduc opened this issue Apr 14, 2023 · 0 comments · Fixed by #11689
Closed

Trace Exporter should respect noexcept qualifiers #11288

dbolduc opened this issue Apr 14, 2023 · 0 comments · Fixed by #11689
Assignees

Comments

@dbolduc
Copy link
Member

dbolduc commented Apr 14, 2023

These are virtual functions and we need to respect the specification.

I tried (and failed) to convince these folks to drop the noexcept.

It seems that we will need to capture all exceptions. Maybe something like this (

// in some header...
bool NoExceptAction(absl::FunctionRef<void()> action) noexcept;

// in some cc
#if GOOGLE_CLOUD_CPP_HAVE_EXCEPTIONS
bool NoExceptAction(absl::FunctionRef<void()> action) noexcept try {
  action();
  return true;
} catch(...) {
  return false;
}
#else
bool NoExceptAction(absl::FunctionRef<void()> action) noexcept {
  action(); // Will crash, would have crashed anyway.
  return true;
}
#endif

// In Recordable.cc
void Recordable::SetIdentity(...) {
  usable_ = usable_ & NoExceptAction([&]() { SetIdentityImpl(...); });
}

Then we will drop (not send to Cloud Trace) any Recordables where usable_ is false.

This is all for a TODO bug and future PRs.

Originally posted by @coryan in #11286 (comment)

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 a pull request may close this issue.

1 participant