mie: add some more status codes

This commit is contained in:
2025-09-08 15:39:41 +01:00
parent 6b62e81ac0
commit 5a56566939
2 changed files with 43 additions and 0 deletions

View File

@@ -1,12 +1,24 @@
#ifndef MIE_STATUS_H_
#define MIE_STATUS_H_
#include <mie/misc.h>
#define MIE_ERROR_VENDOR (ivy_error_vendor())
struct b_error_vendor;
enum mie_status {
MIE_SUCCESS = 0,
MIE_ERR_EOF,
MIE_ERR_BAD_SYNTAX,
MIE_ERR_BAD_FORMAT,
MIE_ERR_NOT_SUPPORTED,
MIE_ERR_INVALID_VALUE,
MIE_ERR_INTERNAL_FAILURE,
MIE_ERR_NO_MEMORY,
MIE_ERR_NO_ENTRY,
};
MIE_API const struct b_error_vendor *mie_error_vendor(void);
#endif

31
mie/status.c Normal file
View File

@@ -0,0 +1,31 @@
#include <blue/core/error.h>
#include <errno.h>
#include <mie/status.h>
static const b_error_definition error_defs[] = {
B_ERROR_DEFINITION(MIE_SUCCESS, "SUCCESS", "Success"),
B_ERROR_DEFINITION(MIE_ERR_EOF, "EOF", "Unexpected end of file"),
B_ERROR_DEFINITION(MIE_ERR_BAD_SYNTAX, "BAD_SYNTAX", "Invalid syntax"),
B_ERROR_DEFINITION(MIE_ERR_NO_MEMORY, "NO_MEMORY", "Out of memory"),
B_ERROR_DEFINITION(
MIE_ERR_NOT_SUPPORTED, "NOT_SUPPORTED",
"Operation not supported"),
B_ERROR_DEFINITION(
MIE_ERR_INTERNAL_FAILURE, "INTERNAL_FAILURE",
"Internal failure"),
B_ERROR_DEFINITION(
MIE_ERR_INVALID_VALUE, "INVALID_VALUE", "Invalid value"),
B_ERROR_DEFINITION(MIE_ERR_NO_ENTRY, "NO_ENTRY", "Name does not exist"),
B_ERROR_DEFINITION(MIE_ERR_BAD_FORMAT, "BAD_FORMAT", "Bad format"),
};
static const b_error_vendor error_vendor = {
.v_name = "Mie",
.v_error_definitions = error_defs,
.v_error_definitions_length = sizeof error_defs,
};
const struct b_error_vendor *mie_error_vendor(void)
{
return &error_vendor;
}