[studio] Add NoChangeException

This commit is contained in:
Gary Talent 2024-05-22 00:35:20 -05:00
parent c47f48eba7
commit 6971c3109a
2 changed files with 10 additions and 1 deletions

View File

@ -134,11 +134,13 @@ class Editor: public studio::BaseEditor {
void pushCommand(ox::UPtr<UndoCommand> &&cmd) noexcept;
template<typename UC, typename ...Args>
void pushCommand(Args&&... args) noexcept {
bool pushCommand(Args&&... args) noexcept {
try {
m_undoStack.push(ox::make_unique<UC>(ox::forward<Args>(args)...));
return true;
} catch (ox::Exception const&ex) {
oxLogError(ex.toError());
return false;
}
}

View File

@ -4,8 +4,15 @@
#pragma once
#include <ox/std/error.hpp>
namespace studio {
class NoChangesException: public ox::Exception {
public:
inline NoChangesException(): ox::Exception(OxError(1, "Command makes no changes.")) {}
};
class UndoCommand {
public:
virtual ~UndoCommand() noexcept = default;