C is a notoriously bad language when it comes to error handling. Many
system/POSIX/UNIX APIs will return various values on error or set
errno(3). An integer error value can
generally tell you the reason an error occurred, but it doesn’t provide extra
information like file, line number, or any extra context.
To overcome this issue, the authors of HSE came up with
an error value which can encode all this information in just a 64-bit unsigned
integer. This repository is essentially a copy and paste of what exists within
HSE. Because of that you will see the original
Micron Technology, Inc.
copyright in addition to the dual licensing of this code as
MIT depending on what best fits within your constraints.
libmerr can be used in the following ways:
There are a few other functions in the header file for getting the error, file, line number, and context should you need them. Refer to the repository for more details.