Skip to content

Commit

Permalink
mx_mysql: Refactor error handling
Browse files Browse the repository at this point in the history
The current error handling in mx_mysql logs errors multiple times in
different forms due to nested functions and the mapping of MySQL error
codes to system error codes. This leads to unclear semantics and
complicated code.

The current error handling return the same error in errno and in the
function return value which results in uneeded accesses to errno

This commit introduces the following changes:

*   MySQL error strings are captured but not logged by the module. A new
    function mx_mysql_error() is provided for the caller to retrieve the
    latest error string.
*   System error codes are returned as the function value, but errno is
    not set.
*   It is now the caller's responsibility to log errors.

This change reduces the object size of mx_mysql by 28%. Future commits
will address error return values that do not relate to MySQL error
strings.
  • Loading branch information
donald committed Dec 29, 2023
1 parent 03e404d commit 7777073
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 235 deletions.
Loading

0 comments on commit 7777073

Please sign in to comment.