lib/error: Add ErrorOrVoid

This allows for error propagation on functions that would otherwise
not return anything.
Soda
BodgeMaster 2022-08-24 01:21:38 +02:00
parent 4934a78aaa
commit 1b8819ffe5
1 changed files with 12 additions and 0 deletions

View File

@ -46,8 +46,20 @@ struct ErrorOr {
}
};
struct ErrorOrVoid {
bool isError;
uint8_t errorCode;
ErrorOrVoid() {
this->isError = false;
this->errorCode = 0;
}
ErrorOrVoid(bool isError, uint8_t errorCode) {
this->isError = isError;
this->errorCode = errorCode;
}
};
namespace ErrorCodes {
// These are all arbitrary values used to assign error codes to different