Migrate to error constants in glacier

This commit is contained in:
Drew Galbraith 2023-06-21 18:28:54 -07:00
parent 3ab9b4d818
commit 0b86a94f14
30 changed files with 171 additions and 114 deletions

View file

@ -0,0 +1,39 @@
#pragma once
#include <stdint.h>
namespace glcr {
typedef uint64_t ErrorCode;
#define RET_ERR(expr) \
{ \
z_err_t _tmp_err = expr; \
if (_tmp_err != glcr::OK) { \
return _tmp_err; \
} \
}
static const uint64_t OK = 0x0;
// First set of error codes generally indicate user errors.
static const uint64_t INVALID_ARGUMENT = 0x1;
static const uint64_t NOT_FOUND = 0x2;
static const uint64_t PERMISSION_DENIED = 0x3;
static const uint64_t NULL_PTR = 0x4;
static const uint64_t EMPTY = 0x5;
static const uint64_t ALREADY_EXISTS = 0x6;
static const uint64_t BUFFER_SIZE = 0x7;
static const uint64_t FAILED_PRECONDITION = 0x8;
// Second set of error codes generally indicate service errors.
static const uint64_t INTERNAL = 0x100;
static const uint64_t UNIMPLEMENTED = 0x101;
static const uint64_t EXHAUSTED = 0x102;
// Kernel specific error codes (relating to capabilities).
static const uint64_t CAP_NOT_FOUND = 0x1000;
static const uint64_t CAP_WRONG_TYPE = 0x1001;
static const uint64_t CAP_PERMISSION_DENIED = 0x1002;
} // namespace glcr