apache / celix

Apache Celix is a framework for C and C++14 to develop dynamic modular software applications using component and in-process service-oriented programming.
https://celix.apache.org/
Apache License 2.0
158 stars 84 forks source link

Unified Error Codes for libdfi #724

Open PengZheng opened 5 months ago

PengZheng commented 5 months ago

Intro

Currently each component (by component we mean .h/.c pair, which is borrowed from Lakos' Large Scale C++) in libdfi has its own error code definition:

In dyn_function.c, we have:

static const int OK = 0;
static const int ERROR = 1;

In dyn_type.c, there is:

static const int OK = 0;
static const int ERROR = 1;
static const int MEM_ERROR = 2;
static const int PARSE_ERROR = 3;

Unified Error Codes

Given that celix_status_t now support a custom facility error part, I think the int return can be upgraded to a celix_status_t. And because celix_status_t is a typedef to int, this maybe is even backwards compatible.

But this would be nice as a future enhancement and port of this pull request.

_Originally posted by @pnoltes in https://github.com/apache/celix/pull/699#discussion_r1471690851_