From 1b8819ffe5da3e172c78d981cebabd3aa5dedd02 Mon Sep 17 00:00:00 2001 From: BodgeMaster <> Date: Wed, 24 Aug 2022 01:21:38 +0200 Subject: [PATCH] lib/error: Add ErrorOrVoid This allows for error propagation on functions that would otherwise not return anything. --- src/lib/error.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/error.hpp b/src/lib/error.hpp index 1d6099d..2cc55ef 100644 --- a/src/lib/error.hpp +++ b/src/lib/error.hpp @@ -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