improve error handling#230
Open
TingDaoK wants to merge 1 commit into
Open
Conversation
graebm
approved these changes
Feb 14, 2024
| struct aws_json_value *document_root = aws_json_value_new_from_string(allocator, document); | ||
| if (document_root == NULL) { | ||
| AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse document as Json document."); | ||
| aws_raise_error(AWS_ERROR_INVALID_ARGUMENT); |
Contributor
There was a problem hiding this comment.
we should fix this in aws-c-common
aws_json_value_new_from_string() ought to raise an error
and that error should be AWS_ERROR_INVALID_JSON, which would be more useful than INVALID_ARGUMENT
waahm7
approved these changes
Feb 14, 2024
| @@ -42,9 +42,6 @@ struct aws_credentials_provider *aws_credentials_provider_new_anonymous( | |||
| struct aws_credentials_provider *provider = aws_mem_calloc(allocator, 1, sizeof(struct aws_credentials_provider)); | |||
|
|
|||
| struct aws_credentials *credentials = aws_credentials_new_anonymous(allocator); | |||
Contributor
There was a problem hiding this comment.
Probably fine here, but I think it would be better to keep the null check as a design pattern. What if this function starts failing in the future? We should not make assumptions about the return value at this level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO
Same thing for all the other repos. not finishing it as other stuff is more high priority, and too many of those.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.