From 98fbbafef78057c818fb02b15c27e38ad2f5b5bc Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:56:07 +0100 Subject: 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() --- .../algorithm/tiled/monocle/MonocleAlgorithm.cpp | 6 +++--- .../algorithm/tiled/monocle/MonocleAlgorithm.hpp | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/layout/algorithm/tiled/monocle') diff --git a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp index 29810fb2..36c59a4e 100644 --- a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp +++ b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp @@ -165,11 +165,11 @@ SP CMonocleAlgorithm::getNextCandidate(SP old) { return next->get()->target.lock(); } -std::expected CMonocleAlgorithm::layoutMsg(const std::string_view& sv) { +Config::ErrorResult CMonocleAlgorithm::layoutMsg(const std::string_view& sv) { CVarList2 vars(std::string{sv}, 0, 's'); if (vars.size() < 1) - return std::unexpected("layoutmsg requires at least 1 argument"); + return Config::configError("layoutmsg requires at least 1 argument", Config::eConfigErrorLevel::ERROR, Config::eConfigErrorCode::INVALID_ARGUMENT); const auto COMMAND = vars[0]; @@ -181,7 +181,7 @@ std::expected CMonocleAlgorithm::layoutMsg(const std::string_ return {}; } - return std::unexpected(std::format("Unknown monocle layoutmsg: {}", COMMAND)); + return Config::configError(std::format("Unknown monocle layoutmsg: {}", COMMAND), Config::eConfigErrorLevel::ERROR, Config::eConfigErrorCode::INVALID_ARGUMENT); } std::optional CMonocleAlgorithm::predictSizeForNewTarget() { diff --git a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp index b23f85be..3f07748b 100644 --- a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp +++ b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.hpp @@ -21,20 +21,20 @@ namespace Layout::Tiled { CMonocleAlgorithm(); virtual ~CMonocleAlgorithm(); - virtual void newTarget(SP target); - virtual void movedTarget(SP target, std::optional focalPoint = std::nullopt); - virtual void removeTarget(SP target); + virtual void newTarget(SP target); + virtual void movedTarget(SP target, std::optional focalPoint = std::nullopt); + virtual void removeTarget(SP target); - virtual void resizeTarget(const Vector2D& Δ, SP target, eRectCorner corner = CORNER_NONE); - virtual void recalculate(); + virtual void resizeTarget(const Vector2D& Δ, SP target, eRectCorner corner = CORNER_NONE); + virtual void recalculate(); - virtual SP getNextCandidate(SP old); + virtual SP getNextCandidate(SP old); - virtual std::expected layoutMsg(const std::string_view& sv); - virtual std::optional predictSizeForNewTarget(); + virtual Config::ErrorResult layoutMsg(const std::string_view& sv); + virtual std::optional predictSizeForNewTarget(); - virtual void swapTargets(SP a, SP b); - virtual void moveTargetInDirection(SP t, Math::eDirection dir, bool silent); + virtual void swapTargets(SP a, SP b); + virtual void moveTargetInDirection(SP t, Math::eDirection dir, bool silent); private: std::vector> m_targetDatas; -- cgit v1.2.3