[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[task #16263] Errors in the library: remove all exit() calls
From: |
Jash Shah |
Subject: |
[task #16263] Errors in the library: remove all exit() calls |
Date: |
Wed, 9 Nov 2022 07:12:49 -0500 (EST) |
Follow-up Comment #3, task #16263 (project gnuastro):
I've been working on the new _error.h_ module for the library. After many
discussions, we decided to go with the _gal_error_t_ structure to hold a list
of all the errors encountered as suggested by Mohammad. However, a few
additions have been made:
typedef struct gal_error_t
{
uint8_t code; /* Code of the problem wrt to each library.*/
uint8_t lib_code; /* Library which created the error. */
uint8_t is_warning; /* Defines if the error is only a warning. */
char *back_msg; /* Detailed message of backend (library) */
char *front_msg; /* Detailed message of front end (caller). */
struct gal_error_t *next; /* Next error message. */
} gal_error_t;
Here, the 8 bit library code(`lib_code`) indicates which library
generated the error. All libraries have their own unique
code defined in alphabetical order inside an enum.
8 bit flag indicating if the error is a breaking error or just a
warning(`is_warning`).
The 8 bit error typecode(`code`) indicates the type of error within that
library. Each library has its own error types defined as 32-bit macros. These
macros are constructed to hold the value of all three above-mentioned
attributes.
I've also added some basic functions for error handling and parsing of the
_gal_error_t_ structure. The cosmology module has been changed to now use this
new error module.
Here is the commit with the work done till now:
https://github.com/Jash-Shah/gnuastro-jash/commit/f8fd0a8ccdc863ac0b430da2ce3c28d0be86e13e
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/task/?16263>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [task #16263] Errors in the library: remove all exit() calls,
Jash Shah <=