From ffe1850dd8b55b62e85f4d0892d08998c9253f21 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sat, 17 Jan 2026 22:49:37 -0500 Subject: [PATCH] Working on timestamps --- CMakeLists.txt | 3 +++ include/akerror.tmpl.h | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0d1265..52fd3b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,9 +36,11 @@ target_compile_definitions(akerror add_executable(test_err_catch tests/err_catch.c) add_executable(test_err_cleanup tests/err_cleanup.c) add_executable(test_err_trace tests/err_trace.c) +add_executable(test_err_unhandled tests/err_unhandled.c) add_test(NAME err_catch COMMAND test_err_catch) add_test(NAME err_cleanup COMMAND test_err_cleanup) add_test(NAME err_trace COMMAND test_err_trace) +add_test(NAME err_unhandled COMMAND test_err_unhandled) # Specify include directories for the library's headers (if applicable) target_include_directories(akerror PUBLIC @@ -48,6 +50,7 @@ target_include_directories(akerror PUBLIC target_link_libraries(test_err_catch PRIVATE akerror) target_link_libraries(test_err_cleanup PRIVATE akerror) target_link_libraries(test_err_trace PRIVATE akerror) +target_link_libraries(test_err_unhandled PRIVATE akerror) set(main_lib_dest "lib/my_library-${MY_LIBRARY_VERSION}") install(TARGETS akerror EXPORT akerror DESTINATION "lib/") diff --git a/include/akerror.tmpl.h b/include/akerror.tmpl.h index 8c69f09..7a74960 100644 --- a/include/akerror.tmpl.h +++ b/include/akerror.tmpl.h @@ -66,6 +66,8 @@ extern akerr_ErrorContext AKERR_ARRAY_ERROR[AKERR_MAX_ARRAY_ERROR]; extern akerr_ErrorUnhandledErrorHandler akerr_handler_unhandled_error; extern akerr_ErrorLogFunction akerr_log_method; extern akerr_ErrorContext *__akerr_last_ignored; +extern akerr_ErrorContext *__akerr_last_prepared; +extern int __akerr_last_attempt_id; akerr_ErrorContext AKERR_NOIGNORE *akerr_release_error(akerr_ErrorContext *ptr); akerr_ErrorContext AKERR_NOIGNORE *akerr_next_error(); @@ -224,10 +226,13 @@ void akerr_init_errno(void); }; \ }; \ if ( __err_context != NULL ) { \ - if ( __err_context->handled == false && __pass_up == true ) { \ - __err_context->stacktracebufptr += snprintf(__err_context->stacktracebufptr, AKERR_MAX_ERROR_STACKTRACE_BUF_LENGTH, "%s:%s:%d\n", (char *)__FILE__, (char *)__func__, __LINE__); \ + __err_context->stacktracebufptr += snprintf(__err_context->stacktracebufptr, AKERR_MAX_ERROR_STACKTRACE_BUF_LENGTH, "%s:%s:%d\n", (char *)__FILE__, (char *)__func__, __LINE__); \ + if ( __err_context->handled == false && __pass_up == true && __err_context->arrayid > 0 ) { \ return __err_context; \ - } \ + } else if ( __err_context->handled == false ) { \ + LOG_ERROR_WITH_MESSAGE(__err_context, "Unhandled Error"); \ + akerr_handler_unhandled_error(__err_context); \ + } \ } \ RELEASE_ERROR(__err_context);