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

cleanup(generator): api version error handling #14512

Merged
merged 2 commits into from
Jul 20, 2024

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Jul 20, 2024

Part of the work for #14510

In practice, this function does not return errors. If it did return an error, we would generate code that doesn't compile, or abort. So just move the abort into the function, and simplify the return type.


This change is Reviewable

Copy link

codecov bot commented Jul 20, 2024

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Project coverage is 93.59%. Comparing base (3fed367) to head (6fade38).
Report is 3 commits behind head on main.

Files Patch % Lines
generator/internal/http_option_utils.cc 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14512      +/-   ##
==========================================
- Coverage   93.59%   93.59%   -0.01%     
==========================================
  Files        2316     2316              
  Lines      207105   207100       -5     
==========================================
- Hits       193838   193833       -5     
  Misses      13267    13267              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbolduc dbolduc marked this pull request as ready for review July 20, 2024 07:44
@dbolduc dbolduc requested a review from a team as a code owner July 20, 2024 07:44
absl::StrCat("Unrecognized API version in package name: ",
method.file()->package()),
GCP_ERROR_INFO().WithMetadata("method", method.full_name()));
GCP_LOG(FATAL) << "Unrecognized API version in package name: "
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize you are moving the GCP_LOG(FATAL) from a different location, but these are a terrible idea in the generator.

The generator runs N threads at a time. This will kill all the threads, not just the one that failed. It will leave many many files in a broken state. I think error handling in the generator needs rethinking, or maybe the idea of using one giant configuration file to call N threads needs rethinking (related to #14448).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack

method.file()->package()),
GCP_ERROR_INFO().WithMetadata("method", method.full_name()));
GCP_LOG(FATAL) << "Unrecognized API version in package name: "
<< method.file()->package()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the filename available? If so, please log that, and the line number. That is easier to find than package names.

Copy link
Member Author

Choose a reason for hiding this comment

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

Included the file name.

@dbolduc dbolduc merged commit a86e887 into googleapis:main Jul 20, 2024
63 checks passed
@dbolduc dbolduc deleted the generator-api-version branch July 20, 2024 16:35
cuiy0006 pushed a commit to cuiy0006/google-cloud-cpp that referenced this pull request Jul 22, 2024
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