libropkg: add error message definitions

This commit is contained in:
2025-07-21 22:43:32 +01:00
parent 10603ed2d1
commit 2480e9950c
2 changed files with 150 additions and 0 deletions

View File

@@ -1,6 +1,15 @@
#ifndef ROPKG_STATUS_H_
#define ROPKG_STATUS_H_
#include <blue/core/error.h>
#include <ropkg/misc.h>
#define ROPKG_ERROR_VENDOR (ropkg_error_vendor())
#define ROPKG_RESULT_ERR(code) \
b_error_with_code(ROPKG_ERROR_VENDOR, ROPKG_ERR_##code)
#define ROPKG_RESULT_SUCCESS B_RESULT_SUCCESS
enum ropkg_status {
ROPKG_SUCCESS = 0,
ROPKG_ERR_NOT_SUPPORTED,
@@ -9,6 +18,34 @@ enum ropkg_status {
ROPKG_ERR_BAD_STATE,
ROPKG_ERR_INTERNAL_FAILURE,
ROPKG_ERR_IO_FAILURE,
ROPKG_ERR_DIR_OPEN_FAILED,
ROPKG_ERR_INSTANCE_DIR_CREATE_FAILED,
ROPKG_ERR_FILE_OPEN_FAILED,
ROPKG_ERR_INVALID_VERSION_FORMAT,
};
enum ropkg_error_msg {
ROPKG_EMSG_SUCCESS = 0,
ROPKG_EMSG_AVAILABLE_RELEASE_PHASES,
ROPKG_EMSG_AVAILABLE_VERSION_RELEASE_PHASES,
ROPKG_EMSG_INVALID_UPSTREAM_VERSION_UNKNOWN_START,
ROPKG_EMSG_INVALID_UPSTREAM_VERSION_TWO_DOTS,
ROPKG_EMSG_INVALID_UPSTREAM_VERSION_END_DOT,
ROPKG_EMSG_INVALID_UPSTREAM_VERSION_TOO_MANY_NUMBERS,
ROPKG_EMSG_INVALID_RELEASE_PHASE,
ROPKG_EMSG_INVALID_VERSION_RELEASE_PHASE,
ROPKG_EMSG_INVALID_VERSION_RELEASE_PHASE_UNKNOWN_START,
ROPKG_EMSG_INVALID_PACKAGE_REVISION_UNKNOWN_START,
ROPKG_EMSG_INVALID_VERSION_UNKNOWN_END,
};
ROPKG_API const struct b_error_vendor *ropkg_error_vendor(void);
#endif