Skip to content

Commit

Permalink
Fix a bunch of places we forget to aws_raise_error() (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm authored Feb 13, 2024
1 parent 7f55a9c commit cc7425e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'main'

env:
BUILDER_VERSION: v0.9.49
BUILDER_VERSION: v0.9.55
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
BUILDER_SOURCE: releases
PACKAGE_NAME: aws-c-common
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:

env:
BUILDER_VERSION: v0.9.37
BUILDER_VERSION: v0.9.55
BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net
BUILDER_SOURCE: releases
PACKAGE_NAME: aws-c-common
Expand Down
2 changes: 1 addition & 1 deletion include/aws/common/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ int aws_byte_buf_append_json_string(const struct aws_json_value *value, struct a
* @param value The aws_json_value to format.
* @param output The destination for the JSON string
* @return AWS_OP_SUCCESS if the JSON string was allocated to output without any errors
* Will return AWS_ERROR_INVALID_ARGUMENT if the value passed is not an aws_json_value or if there
* Will return AWS_OP_ERR if the value passed is not an aws_json_value or if there
* aws an error appending the JSON into the byte buffer.
*/
AWS_COMMON_API
Expand Down
4 changes: 2 additions & 2 deletions source/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ int aws_byte_buf_append_json_string(const struct aws_json_value *value, struct a

char *tmp = cJSON_PrintUnformatted(cjson);
if (tmp == NULL) {
return AWS_OP_ERR;
return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
}

// Append the text to the byte buffer
Expand All @@ -415,7 +415,7 @@ int aws_byte_buf_append_json_string_formatted(const struct aws_json_value *value

char *tmp = cJSON_Print(cjson);
if (tmp == NULL) {
return AWS_OP_ERR;
return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
}

// Append the text to the byte buffer
Expand Down
2 changes: 1 addition & 1 deletion source/log_formatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static int s_default_aws_log_formatter_format(
struct aws_default_log_formatter_impl *impl = formatter->impl;

if (formatted_output == NULL) {
return AWS_OP_ERR;
return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions source/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ int aws_thread_id_t_to_string(aws_thread_id_t thread_id, char *buffer, size_t bu
unsigned char c = bytes[i - 1];
int written = snprintf(buffer + current_index, bufsz - current_index, "%02x", c);
if (written < 0) {
return AWS_OP_ERR;
return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
}
current_index += written;
if (bufsz <= current_index) {
return AWS_OP_ERR;
return aws_raise_error(AWS_ERROR_SHORT_BUFFER);
}
}
return AWS_OP_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion tests/encoding_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ static int s_utf8_validation_callback_always_fails(const uint32_t codepoint, voi
static int s_utf8_validation_callback_always_passes(const uint32_t codepoint, void *user_data) {
(void)codepoint;
(void)user_data;
return AWS_ERROR_SUCCESS;
return AWS_OP_SUCCESS;
}

static struct utf8_example s_valid_utf8_examples_for_callback[] = {
Expand Down

0 comments on commit cc7425e

Please sign in to comment.