diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-28 15:56:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-28 15:56:07 +0100 |
| commit | 98fbbafef78057c818fb02b15c27e38ad2f5b5bc (patch) | |
| tree | c62aa1eae704e7595d58f7edeb3804e8bfd0099d /src/config/shared/actions/ConfigActions.hpp | |
| parent | d4c6ff434c5c7aa66bc7c28e5ce336d2a694bfcc (diff) | |
config/errors: Report and categorize errors properly for actions (#14192)
Makes all errors categorized, some not displayed, some displayed.
All errors can be obtained after hl.dispatch()
Diffstat (limited to 'src/config/shared/actions/ConfigActions.hpp')
| -rw-r--r-- | src/config/shared/actions/ConfigActions.hpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/config/shared/actions/ConfigActions.hpp b/src/config/shared/actions/ConfigActions.hpp index b9f54f50..0f16aff7 100644 --- a/src/config/shared/actions/ConfigActions.hpp +++ b/src/config/shared/actions/ConfigActions.hpp @@ -7,19 +7,29 @@ #include "../../../desktop/DesktopTypes.hpp" #include "../../../desktop/Workspace.hpp" #include "../../../helpers/math/Direction.hpp" +#include "../ConfigErrors.hpp" namespace Config::Actions { struct SActionResult { bool passEvent = false; }; + using eActionErrorLevel = Config::eConfigErrorLevel; + using eActionErrorCode = Config::eConfigErrorCode; + using SActionError = Config::SConfigError; + using Config::toString; + + inline std::unexpected<SActionError> actionError(std::string message, eActionErrorLevel level = eActionErrorLevel::ERROR, eActionErrorCode code = eActionErrorCode::UNKNOWN) { + return Config::configError(std::move(message), level, code); + } + enum eTogglableAction : uint8_t { TOGGLE_ACTION_TOGGLE = 0, TOGGLE_ACTION_ENABLE, TOGGLE_ACTION_DISABLE, }; - using ActionResult = std::expected<SActionResult, std::string>; + using ActionResult = std::expected<SActionResult, SActionError>; ActionResult closeWindow(std::optional<PHLWINDOW> window = std::nullopt /* Active */); ActionResult killWindow(std::optional<PHLWINDOW> window = std::nullopt /* Active */); |
