From 9c693eabab94f5ecce780303ef3e690788bbf079 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 10 Jan 2024 17:08:29 +0000 Subject: [PATCH] Tools: Error messages --- tools/bufr_index_build.cc | 2 +- tools/codes_export_resource.cc | 1 + tools/grib_index_build.cc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/bufr_index_build.cc b/tools/bufr_index_build.cc index ac29bd6b7..d05a2f622 100644 --- a/tools/bufr_index_build.cc +++ b/tools/bufr_index_build.cc @@ -86,7 +86,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil printf("--- %s: processing %s\n", tool_name, file); ret = grib_index_add_file(idx, file); if (ret) { - printf("error: %s\n", grib_get_error_message(ret)); + fprintf(stderr, "Error: %s\n", grib_get_error_message(ret)); exit(ret); } return 0; diff --git a/tools/codes_export_resource.cc b/tools/codes_export_resource.cc index 400373d83..f2d484fbb 100644 --- a/tools/codes_export_resource.cc +++ b/tools/codes_export_resource.cc @@ -75,6 +75,7 @@ int main(int argc, char* argv[]) fout = fopen(out_file, "wb"); if (!fout) { fprintf(stderr, "Failed to open output file '%s'\n", out_file); + perror(out_file); return 1; } fin = codes_fopen(full_path, "r"); diff --git a/tools/grib_index_build.cc b/tools/grib_index_build.cc index 6e933da2b..0d294fbaf 100644 --- a/tools/grib_index_build.cc +++ b/tools/grib_index_build.cc @@ -83,7 +83,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil printf("--- %s: processing %s\n", tool_name, file); ret = grib_index_add_file(idx, file); if (ret) { - printf("error: %s\n", grib_get_error_message(ret)); + fprintf(stderr, "Error: %s\n", grib_get_error_message(ret)); exit(ret); } return 0;