From b78260552ad34b15fc225e310bb021ef554dfef6 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 25 Nov 2025 21:49:04 -0600 Subject: [PATCH] Update: FLL Error should handle more standard network error codes. Also add additional text "occurred" when an unhandled error gets printed by FLL Error. --- level_2/fll_error/c/error/string.c | 28 +++++++++ level_2/fll_error/c/error/string.h | 28 +++++++++ level_2/fll_error/c/private-error.c | 109 ++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+) diff --git a/level_2/fll_error/c/error/string.c b/level_2/fll_error/c/error/string.c index cb18613..3339e3b 100644 --- a/level_2/fll_error/c/error/string.c +++ b/level_2/fll_error/c/error/string.c @@ -84,6 +84,34 @@ extern "C" { "%[' is too small for the parameter '%]", "%[%QNot implemented", "%[%QNot supported", + "%[%QAddress not available", + "%[%QAddress is already in use", + "%[%QAddress is already connected", + "%[%QConnection refused", + "%[%QDomain is unknown", + "%[%QInvalid file descriptor", + "%[%QNetwork is unreachable", + "%[%QOperation is prohibited", + "%[%QProtocol is unknown", + "%[%QInvalid socket", + "%[%QOperation timed out", + "%[%QType is unknown", + "%[%QToo many open files", + "%[%QMax file system blocks or inodes reached", + "%[%QInput or output error", + "%[%QFile system is out of space", + "%[%QInvalid option", + "%[%QInvalid value", + "%[%QConnection reset", + "%[%QPipe is closed", + "%[%QClient is unreachable", + "%[%QMax file descriptors reached", + "%[%QNetwork is down", + "%[%QClient is down", + "%[%QDevice is not found", + "%[%QInvalid stream", + "%[%QDirectoy not found", + " occurred", }; #endif // _di_fll_error_s_a_ diff --git a/level_2/fll_error/c/error/string.h b/level_2/fll_error/c/error/string.h index 0b66e5e..b5aab02 100644 --- a/level_2/fll_error/c/error/string.h +++ b/level_2/fll_error/c/error/string.h @@ -115,6 +115,34 @@ extern "C" { fll_error_s_075_too_small_for_parameter_e, fll_error_s_076_implement_not_e, fll_error_s_077_support_not_e, + fll_error_s_078_available_not_available_e, + fll_error_s_079_address_in_use_e, + fll_error_s_080_already_connected_e, + fll_error_s_081_connection_refused_e, + fll_error_s_082_unknown_domain_e, + fll_error_s_083_invalid_file_descriptor_e, + fll_error_s_084_network_unreachable_e, + fll_error_s_085_operation_prohibited_e, + fll_error_s_086_unknown_protocol_e, + fll_error_s_087_invalid_socket_e, + fll_error_s_088_time_out_e, + fll_error_s_089_type_unknown_e, + fll_error_s_090_too_many_open_files_e, + fll_error_s_091_blocks_inodes_exhaust_e, + fll_error_s_092_input_output_e, + fll_error_s_093_out_of_space_e, + fll_error_s_094_invalid_option_e, + fll_error_s_095_invalid_value_e, + fll_error_s_096_connection_reset_e, + fll_error_s_097_pipe_closed_e, + fll_error_s_098_client_unreachable_e, + fll_error_s_099_max_file_descriptors_e, + fll_error_s_100_network_down_e, + fll_error_s_101_client_down_e, + fll_error_s_102_device_not_found_e, + fll_error_s_103_invalid_stream_e, + fll_error_s_104_directory_not_found_e, + fll_error_s_105_occurred_e, }; // enum #endif // _di_fll_error_s_e_ diff --git a/level_2/fll_error/c/private-error.c b/level_2/fll_error/c/private-error.c index 2239d30..797d913 100644 --- a/level_2/fll_error/c/private-error.c +++ b/level_2/fll_error/c/private-error.c @@ -78,22 +78,70 @@ extern "C" { return private_fll_error_print_simple(print, debug, macro_fll_error_s(001_max_arr_length)); } + if (status == F_available_not_address) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(078_available_not_available)); + } + if (status == F_buffer_too_large) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(002_max_buf_length)); } + if (status == F_busy_address) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(079_address_in_use)); + } + + if (status == F_connect) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(080_already_connected)); + } + + if (status == F_connect_refuse) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(081_connection_refused)); + } + + if (status == F_connect_reset) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(096_connection_reset)); + } + + if (status == F_directory_found_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(104_directory_not_found)); + } + + if (status == F_domain_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(082_unknown_domain)); + } + if (status == F_error) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(003_error_occurred)); } + if (status == F_file_descriptor) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(083_invalid_file_descriptor)); + } + + if (status == F_file_descriptor_max) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(099_max_file_descriptors)); + } + + if (status == F_file_open_max) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(090_too_many_open_files)); + } + if (status == F_file_found_not) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(004_file_not_found)); } + if (status == F_filesystem_quota_block) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(091_blocks_inodes_exhaust)); + } + if (status == F_implement_not) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(076_implement_not)); } + if (status == F_input_output) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(092_input_output)); + } + if (status == F_memory) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(005_memory_problem)); } @@ -102,10 +150,58 @@ extern "C" { return private_fll_error_print_simple(print, debug, macro_fll_error_s(006_unable_allocate)); } + if (status == F_network_client_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(101_client_down)); + } + + if (status == F_network_device_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(102_device_not_found)); + } + + if (status == F_network_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(100_network_down)); + } + + if (status == F_network_reach_client_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(098_client_unreachable)); + } + + if (status == F_network_reach_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(084_network_unreachable)); + } + + if (status == F_option_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(094_invalid_option)); + } + if (status == F_parameter) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(007_invalid_parameter)); } + if (status == F_pipe) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(097_pipe_closed)); + } + + if (status == F_prohibited) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(085_operation_prohibited)); + } + + if (status == F_protocol_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(086_unknown_protocol)); + } + + if (status == F_space_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(093_out_of_space)); + } + + if (status == F_socket_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(087_invalid_socket)); + } + + if (status == F_stream_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(103_invalid_stream)); + } + if (status == F_string_too_large) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(008_max_str_length)); } @@ -114,6 +210,14 @@ extern "C" { return private_fll_error_print_simple(print, debug, macro_fll_error_s(077_support_not)); } + if (status == F_time_out) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(088_time_out)); + } + + if (status == F_type_not) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(089_type_unknown)); + } + if (status == F_utf_not) { return private_fll_error_print_simple(print, debug, macro_fll_error_s(009_invalid_utf8_char)); } @@ -122,6 +226,10 @@ extern "C" { return private_fll_error_print_simple(print, debug, macro_fll_error_s(010_utf8_char_fragment)); } + if (status == F_value) { + return private_fll_error_print_simple(print, debug, macro_fll_error_s(095_invalid_value)); + } + if (status == F_complete_not_utf || status == F_complete_not_utf_eos || status == F_complete_not_utf_stop) { if (print->verbosity != f_console_verbosity_quiet_e) { flockfile(print->to.stream); @@ -163,6 +271,7 @@ extern "C" { fl_print_format(macro_fll_error_s(017_Q), print->to, print->context, print->prefix, print->context); fl_print_format(macro_fll_error_s(018_ui), print->to, print->notable, status, print->notable, print->context); + fl_print_format(macro_fll_error_s(105_occurred), print->to, print->notable, status, print->notable, print->context); private_fll_error_print_debug(print, debug); -- 1.8.3.1