You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2022/02/23 03:54:11 UTC

[GitHub] [celix] xuzhenbao commented on a change in pull request #400: Improved error codes for remote services

xuzhenbao commented on a change in pull request #400:
URL: https://github.com/apache/celix/pull/400#discussion_r812540421



##########
File path: libs/utils/include/celix_errno.h
##########
@@ -61,6 +73,44 @@ typedef int celix_status_t;
  */
 const char* celix_strerror(celix_status_t status);
 
+/*!
+ * Customer error code mask
+ *
+ */
+#define CELIX_CUSTOMER_ERR_MASK 0x20000000
+
+/*!
+ * The facility of system error code,
+ * \note Error code 0 indicates success,it is not system error code.
+ */
+#define CELIX_FACILITY_SYSTEM 0
+
+/*!
+ * The facility of celix default error code
+ *
+ */
+#define CELIX_FACILITY_NULL 1

Review comment:
       In the case of the existing error code value unchanged, I would like to make a distinction between celix default error code and C errno by using `CELIX_FACILITY_NULL` and `CELIX_FACILITY_SYSTEM`(To avoid ambiguity,I will rename `CELIX_FACILITY_SYSTEM` to `CELIX_FACILITY_CERRNO`). And we can replace existing error codes like following:
   ~~~C
   #define CELIX_FACILITY_CERRNO 0
   #define CELIX_FACILITY_NULL 1
   const celix_status_t  CELIX_FRAMEWORK_EXCEPTION = CELIX_ERROR_MAKE(CELIX_FACILITY_NULL,   4471);//=70007
   const celix_status_t  CELIX_FILE_IO_EXCEPTION= CELIX_ERROR_MAKE(CELIX_FACILITY_NULL,   4472);//=70008
   
   const celix_status_t  CELIX_ENOMEM = CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO,   ENOMEM);//=ENOMEM
   const celix_status_t  CELIX_EAGAIN = CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO,   EAGAIN);//=EAGAIN
   ~~~
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@celix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org