Tools: Error messages

This commit is contained in:
Shahram Najm 2024-01-03 13:17:23 +00:00
parent e6aafdb7dc
commit af7778cbdd
4 changed files with 48 additions and 50 deletions

View File

@ -714,7 +714,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(handle1, name, &type1)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -727,7 +727,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
return err;
}
printInfo(handle1);
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -747,7 +747,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
if ((err = grib_get_size(handle1, name, &len1)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -761,7 +761,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
}
printInfo(handle1);
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -826,13 +826,13 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
sval2 = (char*)grib_context_malloc(handle2->context, slen2 * sizeof(char));
if ((err1 = grib_get_string(handle1, name, sval1, &slen1)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
printf("Error: cannot get string value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_string(handle2, name, sval2, &slen2)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
printf("Error: cannot get string value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
save_error(c, name);
}
@ -855,13 +855,13 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
if ((err1 = grib_get_string_array(handle1, name, svals1, &len1)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
printf("Error: cannot get string value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_string_array(handle2, name, svals2, &len2)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
printf("Error: cannot get string value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
save_error(c, name);
}
@ -910,14 +910,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
if ((err1 = grib_get_long_array(handle1, name, lval1, &len1)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
printf("Error: cannot get long value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_long_array(handle2, name, lval2, &len2)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
printf("Error: cannot get long value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
save_error(c, name);
}
@ -995,14 +995,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
if ((err1 = grib_get_double_array(handle1, name, dval1, &len1)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
printf("Error: cannot get double value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_double_array(handle2, name, dval2, &len2)) != GRIB_SUCCESS) {
printInfo(handle1);
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
printf("Error: cannot get double value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
save_error(c, name);
}
@ -1104,14 +1104,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
if ((err1 = grib_get_bytes(handle1, name, uval1, &len1)) != GRIB_SUCCESS) {
printInfo(handle1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
}
if ((err2 = grib_get_bytes(handle2, name, uval2, &len2)) != GRIB_SUCCESS) {
printInfo(handle1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
}
@ -1316,7 +1316,6 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
}
while (grib_keys_iterator_next(iter)) {
name = grib_keys_iterator_get_name(iter);
/*printf("----- comparing %s\n",name);*/
if (blocklisted(name))
continue;
@ -1336,7 +1335,6 @@ static int compare_handles(grib_handle* handle1, grib_handle* handle2, grib_runt
const void *msg1 = NULL, *msg2 = NULL;
size_t size1 = 0, size2 = 0;
int memcmp_ret = 0;
/* int ii=0; */
GRIB_CHECK_NOLINE(grib_get_message(handle1, &msg1, &size1), 0);
GRIB_CHECK_NOLINE(grib_get_message(handle2, &msg2, &size2), 0);
if (size1 == size2 && !(memcmp_ret = memcmp(msg1, msg2, size1))) {

View File

@ -711,7 +711,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -724,7 +724,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
return err;
}
printInfo(h1);
printf("Oops... cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -746,7 +746,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in %s field: %s\n", name, first_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -760,7 +760,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
}
printInfo(h1);
printf("Oops... cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in %s field: %s\n", name, second_str, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -818,14 +818,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
printf("Error: cannot get string value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get string value of [%s] in %s field: %s\n",
printf("Error: cannot get string value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
save_error(c, name);
}
@ -875,14 +875,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
printf("Error: cannot get long value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get long value of [%s] in %s field: %s\n",
printf("Error: cannot get long value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
save_error(c, name);
}
@ -1000,14 +1000,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_double_array(h1, name, dval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
printf("Error: cannot get double value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_double_array(h2, name, dval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get double value of [%s] in %s field: %s\n",
printf("Error: cannot get double value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
save_error(c, name);
}
@ -1121,14 +1121,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
name, first_str, grib_get_error_message(err1));
}
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in %s field: %s\n",
printf("Error: cannot get bytes value of [%s] in %s field: %s\n",
name, second_str, grib_get_error_message(err2));
}

View File

@ -406,7 +406,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -419,7 +419,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
return err;
}
printInfo(h1);
printf("Oops... cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -443,7 +443,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -457,7 +457,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
}
printInfo(h1);
printf("Oops... cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -515,14 +515,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get string value of [%s] in 1st field: %s\n",
printf("Error: cannot get string value of [%s] in 1st field: %s\n",
name, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get string value of [%s] in 2nd field: %s\n",
printf("Error: cannot get string value of [%s] in 2nd field: %s\n",
name, grib_get_error_message(err2));
save_error(c, name);
}
@ -556,14 +556,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get long value of [%s] in 1st field: %s\n",
printf("Error: cannot get long value of [%s] in 1st field: %s\n",
name, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get long value of [%s] in 2nd field: %s\n",
printf("Error: cannot get long value of [%s] in 2nd field: %s\n",
name, grib_get_error_message(err2));
save_error(c, name);
}
@ -625,14 +625,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in 1st field: %s\n",
printf("Error: cannot get bytes value of [%s] in 1st field: %s\n",
name, grib_get_error_message(err1));
}
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in 2nd field: %s\n",
printf("Error: cannot get bytes value of [%s] in 2nd field: %s\n",
name, grib_get_error_message(err2));
}

View File

@ -478,7 +478,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if (type1 == GRIB_TYPE_UNDEFINED && (err = grib_get_native_type(h1, name, &type1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -491,7 +491,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
return err;
}
printInfo(h1);
printf("Oops... cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get type of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -505,7 +505,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err = grib_get_size(h1, name, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in 1st field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -519,7 +519,7 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
}
printInfo(h1);
printf("Oops... cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
printf("Error: cannot get size of [%s] in 2nd field: %s\n", name, grib_get_error_message(err));
save_error(c, name);
return err;
}
@ -567,14 +567,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_string(h1, name, sval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get string value of [%s] in 1st field: %s\n",
printf("Error: cannot get string value of [%s] in 1st field: %s\n",
name, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_string(h2, name, sval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get string value of [%s] in 2nd field: %s\n",
printf("Error: cannot get string value of [%s] in 2nd field: %s\n",
name, grib_get_error_message(err2));
save_error(c, name);
}
@ -608,14 +608,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_long_array(h1, name, lval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get long value of [%s] in 1st field: %s\n",
printf("Error: cannot get long value of [%s] in 1st field: %s\n",
name, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_long_array(h2, name, lval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get long value of [%s] in 2nd field: %s\n",
printf("Error: cannot get long value of [%s] in 2nd field: %s\n",
name, grib_get_error_message(err2));
save_error(c, name);
}
@ -674,14 +674,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_double_array(h1, name, dval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get double value of [%s] in 1st field: %s\n",
printf("Error: cannot get double value of [%s] in 1st field: %s\n",
name, grib_get_error_message(err1));
save_error(c, name);
}
if ((err2 = grib_get_double_array(h2, name, dval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
printf("Oops... cannot get double value of [%s] in 2nd field: %s\n",
printf("Error: cannot get double value of [%s] in 2nd field: %s\n",
name, grib_get_error_message(err2));
save_error(c, name);
}
@ -770,14 +770,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* h1, grib_h
if ((err1 = grib_get_bytes(h1, name, uval1, &len1)) != GRIB_SUCCESS) {
printInfo(h1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in 1st field: %s\n",
printf("Error: cannot get bytes value of [%s] in 1st field: %s\n",
name, grib_get_error_message(err1));
}
if ((err2 = grib_get_bytes(h2, name, uval2, &len2)) != GRIB_SUCCESS) {
printInfo(h1);
save_error(c, name);
printf("Oops... cannot get bytes value of [%s] in 2nd field: %s\n",
printf("Error: cannot get bytes value of [%s] in 2nd field: %s\n",
name, grib_get_error_message(err2));
}