-
Notifications
You must be signed in to change notification settings - Fork 377
Open
Description
Document the error handling convention used in the crun source code. The documentation could for example be added to the file CONTRIBUTING.md or some new file.
Just to give an idea what I'm thinking about, here is a sketch:
-
a function that takes an argument
libcrun_error_t *errand returns a negative return value,
creates an error inerr. The function does not check if a previously created error is overwritten.
To avoid a memory leak, callers of the function should thus pass in anerrthat has not already been created. -
a function that takes an argument
libcrun_error_t *errand returns a non-negative return value,
does not create an error inerr.
By having such error handing convention, the last line
in the following code would be unnecessary:
libcrun_error_t tmp_err = NULL;
ret = some_crun_function (&tmp_err);
if (ret < 0) {
if (tmp_err != NULL) {
Metadata
Metadata
Assignees
Labels
No labels