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

Fix a bunch of places we forget to aws_raise_error() #1089

Merged
merged 3 commits into from
Feb 13, 2024
Merged

Fix a bunch of places we forget to aws_raise_error() #1089

merged 3 commits into from
Feb 13, 2024

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Feb 10, 2024

Our error handling strategy is simple to explain, but easy to get wrong. Inspired by this PR that fixed some obviously-incorrect-code, I decided to search for more easy-to-spot accidents:

  • cmd-shift-f (case sensitive) return AWS_(?!OP_): look for places we accidentally return error codes, instead of raising them
  • cmd-shift-f AWS_ERROR_SUCCESS: look for places we misuse AWS_ERROR_SUCCESS, returning it instead of AWS_OP_SUCCESS. This doesn't cause bugs (they're both 0) but it's not right either.
  • cmd-shift-f return AWS_OP_ERR: Look for places we return AWS_OP_ERR without an error having been raised beforehand. I found A LOT of these mistakes, but I'm sure there are more.

TODO in the future:

  • cmd-shift-f return NULL (there are 1500+ of these)
  • Give more attention to the following files. Which I know have way more problems, but I gave up:
    • json.c in aws-c-common
    • darwin_pki_utils.c in aws-c-io
    • secure_tunneling.c in aws-c-iot
    • serializer.c in aws-c-iot

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (7f55a9c) 83.23% compared to head (fbb4e2d) 83.15%.

Files Patch % Lines
source/json.c 0.00% 2 Missing ⚠️
source/logging.c 0.00% 2 Missing ⚠️
source/log_formatter.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1089      +/-   ##
==========================================
- Coverage   83.23%   83.15%   -0.08%     
==========================================
  Files          56       56              
  Lines        5808     5813       +5     
==========================================
  Hits         4834     4834              
- Misses        974      979       +5     

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

@graebm graebm merged commit cc7425e into main Feb 13, 2024
52 checks passed
@graebm graebm deleted the bad-err branch February 13, 2024 17:41
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.

4 participants