lib/error: Add ErrorOrVoid
This allows for error propagation on functions that would otherwise not return anything.Soda
parent
4934a78aaa
commit
1b8819ffe5
|
@ -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 {
|
namespace ErrorCodes {
|
||||||
// These are all arbitrary values used to assign error codes to different
|
// These are all arbitrary values used to assign error codes to different
|
||||||
|
|
Loading…
Reference in New Issue